Set loaded form in args.caller() d365 for f&O

Hello Everyone,

I want open saleseditlines form with Documentstatus = "ShippingBill_IN" through my class using below code

I am passing loaded form using formrun class.

By calling formrun.Init() and formrun.run() method i am getting random record.

i want to specify record for the same.

How can i modify query available in formrun ?

public static void main(Args _args)
{
CustomsExportOrderTable_IN customsExportOrderTable;
Args argsLoc = new Args();
FormRun formRun;

//hardCode recid for testing job
customsExportOrderTable = CustomsExportOrderTable_in::find(68719492497);

//creating Args for pass in formrun
Args argsFR = new Args();
argsFR.record(customsExportOrderTable);
argsFR.name(formstr(CustomsExportOrderTable_IN));
formRun = classfactory.formRunClass(argsFR);
formRun.init();
formRun.run();

//creating Args for pass in menuItem
argsLoc.record(customsExportOrderTable);
argsLoc.parmEnum(DocumentStatus::ShippingBill_IN);
argsLoc.caller(formRun);

//call menuitem with args to open form
new MenuFunction(menuItemActionStr(SalesFormLetter_ShippingBill_IN), MenuItemType::Action).run(argsLoc);
}

Related
Recommended