Notifications
Announcements
Hello friends,
In form PSAVendorPaymentRetentionRelease -> PSATmpVendInvoiceTable DS -> Init Method
I want to add one more switch case condition for adding my customized form name.
Please tell me how i can do it by using event handler in D365FO.
Thanks & Regards
Rahul
Thank you Martin, it's working.
My mistake - I forgot we're in a data source extension and not a form extension.
Initialize projIdValue by this code:
FormStringControl projIdValue = element.ProjIdValue;
It could also be done this way:
FormStringControl projIdValue = element.control(element.controlId(formControlStr(PSAVendorPaymentRetentionRelease, ProjIdValue)));
[ExtensionOf(FormDatasourceStr(PSAVendorPaymentRetentionRelease,PSATmpVendInvoiceTable))] final class PSAVendorPaymentRetentionRelease_Extension { public void init() { ProjTable projTable; next init(); if (element.args().caller()) { switch (element.args().caller().name()) { case formStr (CON_Order): projTable = element.args().record(); element.projId(projTable.ProjId); ProjIdValue.text(projTable.ProjId); break; } } } }
Can you show us your full code, please?
Dear Martin,
Thank you for your reply.
At line no 12
ProjIdValue.text(projTable.ProjId);
I am getting 'Variable 'ProjIdValue' is not found in scope.'error.
Please tell me how to solve this.
This is not possible - you'll have to look for another solution.
Fortunately, it's very easy:
public void init() { next init(); if (element.args().caller()) { switch (element.args().caller()) { case formStr(YourForm): projTable = element.args().record(); element.projId(projTable.ProjId); ProjIdValue.text(projTable.ProjId); break; } } }
Yes, you'll have to duplicate a few lines of code, which is not ideal but it's the best option you have.
Under review
Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.
As AI tools become more common, we’re introducing a Responsible AI Use…
We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…
These are the community rock stars!
Stay up to date on forum activity by subscribing.
Abhilash Warrier 843 Super User 2025 Season 2
André Arnaud de Cal... 405 Super User 2025 Season 2
Martin Dráb 322 Most Valuable Professional