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

What is the primary purpose of using a Solution in Microsoft Power Platform & ALM?

As organizations embrace low-code development with Microsoft Power Platform , it becomes essential to manage and govern apps, flows, and dat...