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

SQL code to upate one Legal entity banner to all the legal entity in D365

 Hi, update companyimage set  companyimage.Image  = companyimageA.Image  from  ( select Image from companyimage where dataAreaid = 'USF...