How to open form from menu in record insert mode

Hi,
I have a form, displaying records and I have a menu item which opens this form. No problem to this point.
Now I want another menu item which opens this form but I want the form to go directly into new record insert mode.
How can I do this?

Thanks…

OK, I learned to use “sc_apl_conf(“my_form”, “start”, “new”);” code to open a form in record insert mode.
But I want the code to run only when I open the form from the “New Employee” menu item.
Because I’m using the same form in normal grid view with another menu item: “Employees
So, I need to check if “New Employee” menu item is selected by user.

I tried to use following code in onApplicationInit event of “Employees” form :

if ({sc_menu_item} == "item_18")
{
sc_apl_conf("Employees", "start", "new");
}

But when I click the menu item, the form opens in normal grid view and I get the following error:
“Undefined variable: sc_menu_item”

What am I doing wrong?

Solved:
I used the below code in my menu application onExecute event and it worked:

if ({sc_menu_item} == "item_18"):
    sc_apl_conf("Employees", "start", "new");
endif;
1 Like