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.
4 | 4 |
3 | 7 |
5 | 12 |
8 | 20 |
3 | 23 |
9 | 31 |
2 | 33 |
Regards
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.
4 | 4 |
3 | 7 |
5 | 12 |
8 | 20 |
3 | 23 |
9 | 31 |
2 | 33 |
Regards
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.
Best Regards,
Leo
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 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.
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