Thursday, April 21, 2022

Calling formControl in code

 [FormEventHandler(formStr(HcmOpenJobApply), FormEventType::Initialized)]

    public static void HcmOpenJobApply_OnInitialized(xFormRun sender, FormEventArgs e)

    {

        FormRun         element             = sender;

        FormControl ApplyButton = element.design(0).controlName("ApplyButton");

        ApplyButton.enabled(false);

    }








[FormControlEventHandler(formControlStr(HcmOpenJobApply, ApplyButton), FormControlEventType::GotFocus)]

    public static void ApplyButton_OnGotFocus(FormControl sender, FormControlEventArgs e)

    {

        FormRun         element             = sender.formRun();

        FormControl ApplyButton = element.design(0).controlName("ApplyButton");

        ApplyButton.enabled(false);

    }

Tuesday, April 5, 2022

How to set value of form control and delete value from enum in D365 FO

Delete an enum value from enum

Voucher_SettlementType.delete(enum2Str(DAPAccrualsPaymentTypes::BasicSalary));



Set value in form control
Voucher_SettlementType.selection(Value);


Friday, April 1, 2022

Relation between args and table buffer and formdatasource and Get menu item name from formRun and elements

 FormDataSource = _args.caller().datasource();


TableBuffer = FormDataSource.cursor();


TableBuffer = _args.caller().datasource();.cursor();







Get menu item name from formRun and elements

if (element.args().menuItemName() == menuitemdisplaystr(YourFormMenuItem))




FormRun formRun = sender.formRun();

formRun.args().menuItemName()