Sunday, 20 February 2022

OnModified FormEventHandler in D365 F&O

class DDDInventJournalCreateFormEventHandler

{

    [FormControlEventHandler(formControlStr(InventJournalCreate, InventJournalTable_JournalNameId), FormControlEventType::Modified),

    SuppressBPWarning('BPParameterNotUsed', 'False positive')]

    public static void InventJournalTable_JournalNameId_OnModified(FormControl sender, FormControlEventArgs e)

    {

        FormDataSource      inventJournalTable_ds   = sender.dataSourceObject();

        InventJournalTable  inventJournalTable      = inventJournalTable_ds.cursor() as InventJournalTable;

        InventJournalName  inventJournalName = InventJournalName::find(inventJournalTable.JournalNameId);

        inventJournalTable.DDDFinancialDimensions   = (inventJournalName.DDDProcessBudget == NoYes::Yes) ? inventJournalName.DDDFinancialDimensions : 0;

        sender.formRun().design().controlName(formControlStr(InventJournalCreate, DDDTabFinancialDimensions)).visible(inventJournalName.DDDBudget == NoYes::Yes);

    }

}

No comments:

Post a Comment

DefaultDimension in d365 FO X++

 Navigate to PurchTable methods you can find with DefaultDimension this.DefaultDimension = this.mergeDimension(this.getDefaultDimension(),th...