Dynamics Tip: Using business rules to sum up more than two fields

By | October 19, 2017

When defining a formula in the business rules editor, we can only use two entity fields:

image

So, what are we supposed to do when we have, for example, four fields to sum up (other than creating a calculated field or adding a javascript/workflow/plugin)?

image

Turns out, we can simply add multiple actions to the business rule so that every action will add one additional value to the sum field(and the first action will copy value from the first value field):

image

We also have to remember to add all those value fields to the condition just to make sure the business rule kicks in on all field changes:

image

And, once we have that, here is the end result:

image

It works.. Although, I guess it may still be easier to use javascript for thisSmile

3 thoughts on “Dynamics Tip: Using business rules to sum up more than two fields

  1. Abhinav Sobti

    Tried the above workaround, but I got an error saying “You can’t create this rule because it contains a cyclical reference. Fix the rule and try again.”

    Reply
    1. Deepak Mehta

      Change the scope to forms and then it works. If the scope is entity then it throws an error.

      Reply
      1. Thomas

        How come this works?
        Do you have any papers/articles explaining this?
        Thanks

        Reply

Leave a Reply

Your email address will not be published. Required fields are marked *