Thursday, August 2, 2018

Hide a form control in AX 7

In this example I'm going to hide "Description' field from the ledgertrans form.

For that I have created a event handler class in the extension model(Newly created model for extensions and event handlers ).


class LedgerTransAccount_Eventhandler
{
    [FormDataSourceEventHandler(formDataSourceStr(LedgerTransAccount, GeneralJournalAccountEntry), FormDataSourceEventType::Activated)]
    public static void LedgerTrans_OnActivated(FormDataSource sender, FormDataSourceEventArgs e)
    {
        GeneralJournalAccountEntry           generalJournalAccountEntry     = sender.cursor(); //selected record
        FormDataSource      generalJournalAccountEntry_ds  = sender.formRun().dataSource("GeneralJournalAccountEntry");
        FormRun             element       = sender.formRun(); //form element
        FormControl         tabOverview   = element.design(0).controlName("TabOverview"); //New button on the form
        element.control(element.controlId(formControlStr(LedgerTransAccount, LedgerTrans_Txt ))).visible(false);

    }

}

No comments:

Post a Comment

Why do users often get confused about Dynamics 365 Customer Engagement (D365 CE), Dataverse, and the Power Platform?

  The Microsoft ecosystem for business applications can sometimes be difficult to navigate, especially when discussing Dynamics 365 Customer...