web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :

How to get first record of the data source in event handler(Dynamics 365)? #dynamics #ax #d365

Krishna Bhardwaj Profile Picture Krishna Bhardwaj 97

Here I'm showing how can we get the first record of the data source and get the next records by looping or by some condition.

Only for reference, TempTable is the data source. 

public static void OKButton_OnClicking(FormControl sender, FormControlEventArgs e)

{

FormRun             formRun         = sender.formRun();

FormDataSource tempTable_ds  = formRun.dataSource(formDataSourceStr(JmgProductionFloorExecution, TempTable));

TempTable  tempTable           =  tempTable_ds.getFirst();

TempTable  tempTableBuffer;

 while(tempTable)

{

tempTableBuffer.FieldOne = tempTable.FieldOne;

tempTableBuffer.FieldTwo   = tempTable.FieldTwo;

tempTableBuffer.insert();

tempTable  =  tempTable_ds.getNext();

}

}

Comments

*This post is locked for comments