cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Gayu
Helper I
Helper I

plugin

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.

2 REPLIES 2
Ethan_R
Solution Sage
Solution Sage

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 

Sumedha7
Regular Visitor

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

Delete: http://sumedha8.blogspot.com/2012/11/sample-plug-in-delete_1.html

 

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Community Call Conversations

Introducing the Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Users online (3,762)