Skip to main content

Notifications

Customer experience | Sales, Customer Insights,...
Answered

Two step calculations within a plugin

Posted on by 1,795

Hi, 

We're using business rules to run a number of calculations on an entity. A number of the calculations are dependent on other calculations completing first: 

e.g.

c = a + b

d = c - e

In this example, c must first be calculated before the second calculation can take place. At the moment, using business rules, this requires us to save the Record twice. The result of the first calculation must be committed to the db before the second calculation can run. 

If we replaced our business rules with a c# plugin, would the behavior still be the same? Or would we be able to complete both of the above calculations in one plugin trigger?

  • David L. Carr Profile Picture
    David L. Carr 75 on at
    RE: Two step calculations within a plugin

    Hi JM,

    While Business Rules are easy to build, unfortunately you don't have control over when they run.  In fact, they run in order of when the rules were published to the system, so you may be able to get what you want by publishing those rules in order.  But the best solution is to write some JavaScript, as you CAN control the order of events there.

    Hope this helps,

    Dave

  • Verified answer
    Kipetcoff Profile Picture
    Kipetcoff 1,002 on at
    RE: Two step calculations within a plugin

    Hi,

    In plugin you can replace this d = c - e with this d = (a + b) - e

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.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,253 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,188 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans