//Accessing AX FORM global variables in EventHandler static methods in Dynamics 365 for finance and operations
Note: This is only for privately declared variables in FORM
Step 1:
[ExtensionOf(formStr(PurchTable))]
final class DevFormPurchTable_Extension
{
PurchTableType parmpurchTableType()
{
return purchTableType;
}
}
Step 2:
class DevPurchTableEventHandler
{
/// <summary>
///
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
[FormControlEventHandler(formControlStr(PurchTable,
PurchCreateFromSalesorderPurchase), FormControlEventType::Clicked)]
public static void PurchCreateFromSalesorderPurchase_OnClicked(FormControl sender, FormControlEventArgs e)
{
FormRun formRun = sender.formrun();
PurchTableType purchTableTypeGet;
purchTableTypeGet = formRun.parmpurchTableType();
info(strFmt("%1",purchTableTypeGet.parmPurchTable().PurchId));
}
}
Thanks
ReplyDelete