AX – D365FO – Get current data source record

If you want to get the current selected data source record you can use dataSource_ds.cursor() method

See code below

public void executeQuery()
      if(Al0VendorActivity_ds.cursor().RecId != 0)
             QueryBuildDataSource productCategory_ds =       this.query().dataSourceTable(tableNum(Al0VendorSearchCriteria));
             productCategory_ds.addRange(FieldNum(Al0VendorSearchCriteria, VendorActivityRefRecId)).value(int642Str(Al0VendorActivity_ds.cursor().RecId));

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s