Hi guys, Today we see how to get Caller Form Name, Record from Called Form In D365FO.
- Caller form name:
FormRun caller,formRun = sender.formRun();//FormControl(sender) childform Args args = new Args(); ; caller = sender.formRun().args().caller(); if(caller.args().name() == formStr(TestForm)
- Caller data source name:
element.args().dataset() == tableNum(CustTable)
- Caller form menu item name:
FormRun caller = sender.args().caller(); // xFormRun(sender) child form formrun
caller.args().menuItemName() == menuItemDisplayStr(PIDInventSite))
- Get menu item name:
element.args().menuItemName();
- Get current record of caller form:
- Way1 :
- Way2 : (Get Any data source current record)
Example:
Calling From Parent:
In child:
Form Init:
[FormControlEventHandler(formControlStr(TestChild, Ok), FormControlEventType::Clicked)] public static void Ok_OnClicked(FormControl sender, FormControlEventArgs e) { TableA tableA; FormRun caller,formRun = sender.formRun(); Args args = new Args(); ; caller = sender.formRun().args().caller(); if(caller.args().name() == formStr(TestForm)) { tableA= sender.formRun().args().record() as TableA ; info(strfmt('%1',tableA.Id)); } }
Keep Daxing!!
No comments:
Post a Comment