How to Open a Form and Send Records as Arguments in D365 F&O

In Microsoft Dynamics 365 Finance & Operations (D365 F&O), efficient navigation and data transfer between forms are essential for user productivity. This guide explains how to open a form, send a record as an argument, and retrieve it in the opened form.

 

Step 1: Preparing the Caller Form

  • Write a code snippet to open a form with parameters using args and formrun.

 

Args args = new Args(formStr(YoorForm));
FormRun formRun;
args.parm(YourTable);
args.caller(element);
formRun = classFactory.formRunClass(args);
formRun.init();
formRun.run();
formRun.wait();

Step 2: Receiving the Record in the Opened Form

  • Use the init() method to retrieve the record passed in the arguments.

 

public void init()
{
   super();
 
   if(element.args().caller() != null && element.args().dataset()==tableName2id("YourTable"))
   {
       YourTable = element.args().record() as YourTable ;


   }else{
   
           this.detach();
           this.close();
           warning("YourTable Reference is not available");
   
   }
}

Comments

Popular posts from this blog

How to Override the Lookup Method in D365 X++ Form String Control

How to Filter a Form’s Data Source Using X++ in D365 F&O