Tuesday, 8 January 2019

ACTIVE METHOD IN D365 FORM DATASOURCE

FORM ACTIVE METHOD IN D365 DATASOURCE EVENT HANDLERS FOR Activated METHOD 

How to get the event handler for the init method for Init method in D365 forms
You can just write the below code in any new class or else if you have an existing one then just simply copy the code in the class.

The class declaration should read:
[ExtensionOf(formStr(FormName))]final class FormName_Extension{}

So if the form name is SalesTable then the code will be 
[ExtensionOf(formStr(SalesTable ))]
final class SalesTable_Extension{}

In some cases even a class without the extension signature i.e. [ExtensionOf(formStr(SalesTable ))] might not be required but in that case  the this object will not provide the objects in the intellisense.

Note that the class declaration is Final and cannot be further extended.
[FormDataSourceEventHandler(formDataSourceStr(Salestable, Salestable), FormDataSourceEventType::Activated)]
    public static void Salestable_OnActivated(FormDataSource sender, FormDataSourceEventArgs e)
    {
        Salestable           Salestable     = sender.cursor();
        FormDataSource      Salestable_ds  = sender.formRun().dataSource("Salestable");
        FormRun             element       = sender.formRun();
        FormControl         myNewButton   = element.design(0).controlName("anybutton");

        anybutton.enabled(false);
    }

}

No comments:

Post a Comment

AZURE INTERVIEW QUESTIONS AND ANSWERS

AZURE INTERVIEW QUESTIONS AND ANSWERES 2021 2. What is cloud computing? Explanation:  It is the use of servers on the internet to “store...