Notifications
Announcements
No record found.
I have field named AMA that contains decimal values. I would to have another field AMAcum that aggregates all previous records of AMA.
See below table.
Regards
Hi partner,
You could do this by js code.
Please add the following js code into your form properties and add the function to AMA field onchange event.
function getAMAcum(executionContext){ var AMA=executionContext.getFormContext().getAttribute("new_ama"); var AMAvalue=AMA.getValue(); var AMAcum=executionContext.getFormContext().getAttribute("new_amacum"); var AMAcumValue=AMAcum.getValue(); var finalnum=AMAvalue+AMAcumValue; executionContext.getFormContext().getAttribute("new_amacum").setValue(finalnum); }
Hope it helps.
Best Regards,
Leo
Hi Leo,
Thanks a lot for your help. I have created the OnChange Event handler as you guided.
However, I need some guidance on where and how to call the function.
Hi
Once you created your web resource and uploaded and published to crm.
As LeoAlt suggested, you have to add the script to the form, bind it to OnChange of Control ACM and then select the js file name and the onchange event function name.
Hi Bernard,Since you have created the OnChange event and published it, as Microsoft mentioned below, you just need to change the field value to trigger your js function.
https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/events/attribute-onchange
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.
Congratulations to a top community star!
In our never-ending quest to help the Dynamics 365 Community members get answers faster …
Welcome to the next edition of the Community Platform Update. This is a status …
Stay up to date on forum activity by subscribing.