open form with new record

very new to AX, this whould seem to be easy but cannot find a way to get it to work.

have menu Item button and Just want to open the EmplTable Form already positioned at new record.

In the run Method of the form I put :EmplTable_ds.create()

but this did not work…any sugestions ( p.s. I would like only this button to open at new record all others should not)

on the menu item set the following properties,

EnumTypeParameter = FormOpenMode

EnumParameter = ForNew

see example custTableListpage display men item

Thanks

Amir

This seems like it would work but , it did not. I tried with a test from that I created to simplify things. I tried using the FormOpenMode and did not get a new record when the from opened, so not sure if its somthing I’m missing or somthing else I need to do. thanks

This seems like it would work but , it did not. I tried with a test from that I created to simplify things. I tried using the FormOpenMode and did not get a new record when the from opened, so not sure if its somthing I’m missing or somthing elxe I need to do. thanks

Well no one answered bu this is what I found:

EnumTypeParameter = FormOpenMode allows you to to set this via the menu Item then check for it once you open the form, this way if you open the form from diffrent locations you can check to see if the paamter is set to “ForNew” . and if it is then you can open with a new record.

here is the code I used to get the for to open with a new record. In the Run Method I put

public void run()
{
;
super();
if (SysListPageHelper::isFormOpenedWithOpenModeForNewParm( element))
{
emplTable_ds.create();
}
}

plus I set the

  • Call the create method on the form data source.

  • Set the InsertAtEnd property on the form data source to No.

  • Set the StartPosition property on the form data source (to First or Last).

got from :http://msdn.microsoft.com/en-us/library/aa642442.aspx

[Y]

Thanks its really helpful

I found it’s just simply set the property of InsertIfEmpty = Yes at the data source table.

I would like to know whether any procedure need to be followed after setting property of InsertIfEmpty = Yes at the data source table