Plugin code to calculate sum of fields across records:
I have the below requirement to be implemented in plugin code.
I need to add the values of the fields and update it in a new field.
eg: I need to add the values of field called "A" and display the sum of total in the field called " Total".
Just need guidance on how the logic should be written. Any help would be appreciated.
Hi @Gayu ,
Reference to start with Plugin: Link
This is simple,
1. Decide if you want to trigger the plugin on create or update
2. Based on your Target entity, check if the values exists that you want.
3. If you get, calculate Total and save it as new Entity then use service.update to save the record. Else throw error or add Tracelog
4. Sign, Build and register your plugin
5. Add steps (Create and or Update based on your requirement)
6. Test it
Hope this helps
You may also need to consider Delete/ Deactivation options if they are valid scenarios.
If you are new to Plug-ins, below are code snippets to start;
Create/ Update: https://sumedha8.blogspot.com/2012/10/sample-plug-in-code-create.html
Status Change: http://sumedha8.blogspot.com/2012/10/sample-plug-in-state-change.html
Keep up to date with current events and community announcements in the Power Apps community.
A great place where you can stay up to date with community calls and interact with the speakers.
Check out the latest Community Blog from the community!