Alfasith AX

Alfasith AX
اللَّهُمَّ انْفَعْنِي بِمَا عَلَّمْتَنِي، وَعَلِّمْنِي مَا يَنْفَعُنِي، وَزِدْنِي عِلْمًا

Tuesday, June 21, 2022

Calling custom method of other layer objects created in form level in D365

 Hi,


Using an event handler, we cannot call the custom methods created in another later / model/ ISV object. 

On calling formRun.CreateDeliveryNote()  throws the error ‘FormRun doesn't have the method CreateDeliveryNote.

FormDataSource purchTable_ds = sender.datasource();
FormRun formRun = purchTable_ds.formRun();
formRun.CreateDeliveryNote() ;

Conclusion is to use only COC not eventhandler

[ExtensionOf(formDataFieldStr(PurchTable, PurchTable, DeliveryDate))]
final class PurchTableDeliveryDateField_Extension
{
    public void modified()
    {
         next modified();
         element.CreateDeliveryNote(); // Custom method from Other Later / Model 
    }
}


Regards

No comments:

Post a Comment

How find size of recordsortedlist in D365/AX 2012

Hi, This is the continuity of the previous article where we are now getting the size of recordsortedlist . if(recordsortedlist.len() >1) ...