Thursday, August 2, 2018

Accessing AXFORM global variables in EventHandler methods Dynamics 365 for finance and operations


//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));
}
}


1 comment:

Copy Markup charges while posting purchase invoice using X++

 Copy Markup charges while posting purchase invoice using X++ Class: Important: Code logic is just for Reference.  New class => Duplicate...