Skip to main content

Notifications

Community site session details

Community site session details

Session Id :

How to get selected records of form data source? #ax #D365 #dynamics

Krishna Bhardwaj Profile Picture Krishna Bhardwaj 97
Today I'll discuss about how we can get all the selected records of form data source. My requirement is to perform some functionality only if one record is selected, for that I created an extension class of the form data source and wrote my code in the active method to meet my requirement.

public int active()

{
int ret;
ret = next active();
SalesLine salesLineLoc;           
FormDataSource SalesLine_ds = this;
MultiSelectionHelper selectionHelper = MultiSelectionHelper::construct();  
           selectionHelper.parmDataSource(SalesLine_ds);
           int counting = 0;
salesLineLoc  = selectionHelper.getFirst(); 
           if (salesLineLoc.RecId)
           {
                  while (salesLineLoc)
                  {
                         salesLineLoc = selectionHelper.getNext();
                          counting++;
                    }
            }
            if (counting == 1)  //If one record is selected
            {
                // statements;
}
return ret;
}

 

Comments

*This post is locked for comments