How to get first record of the data source in event handler(Dynamics 365)? #dynamics #ax #d365
Views (78)
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();
}
}

Like
Report
*This post is locked for comments