Skip to main content

Notifications

Microsoft Dynamics CRM (Archived)

Rollup field calculation not working

Posted on by 7,316

Hi,

I am trying to use a rollup field for the first time. I have a Case entity and it's child entity 'Expenses'. Each expense record has a currency field which in turn is a calculated field. This field calculates total amount of the expense record.

So, I need my rollup field to calculate the total of each expense record(Calculated field). I know that rollup fields can't reference a calculated field and So I've created a hidden currency field on expense record and added a script to copy the calculated value. And then, used that hidden field for calculating rollup value on Case form.

But nothing happens on the case form when I created a couple of expense records. The rollup field(on case Form) always remains blank, I did press refresh button.  The calculation itself is fairly simple. Just the sum of all the expense amounts. What could be the reason.. please guide me through this.

Thanks for any help.

*This post is locked for comments

  • Yoya Profile Picture
    Yoya 30 on at
    RE: Rollup field calculation not working

    It's old but issue on existing source record is still present so updating the source record (anything, just temp modification of the name) and saving do the trick. After that the calculation button works

  • KoJaPD Profile Picture
    KoJaPD 116 on at
    RE: Rollup field calculation not working

    Hi meenoo,

    I know this is an old thread, but I am experiencing the same problem with rollup fields that only work for newly created records. What do I have to do in order to get the rollup field working for the existing records?

    Thanks,

    Koen

  • Vipin J Profile Picture
    Vipin J 1,583 on at
    RE: Rollup field calculation not working

    I am not sure about the solution here, but would like to share my little RnD about Roll-up fields
    https://vjcity.blogspot.com/2019/06/dissecting-rollup-fields-in-dynamic-365.html

  • Alphabetman Profile Picture
    Alphabetman on at
    RE: Rollup field calculation not working

    I may be late to the party but can you share your script with me?

    I am tryign to do somethign similar.

    I created a calculated field to grab the parent account number.

    then in turn i want to map the parent account number to the order entity.

    I need a script to write the calculated parent account number 5 digits to the open field parent account so i can map that to order entity.

    First time trying this so any help would be appreciated.

  • meenoo Profile Picture
    meenoo 7,316 on at
    RE: Rollup field calculation not working

    I figured the problem was with the transactioncurrencyid being 'null' for all the existing records that were created before rollup field. That's why all the new records with rollup field work properly.

    I am not sure how to workaround through this issue. So opening new question about it.

    As far as this thread, I was able to pass through this issue.

    Thanks.

  • meenoo Profile Picture
    meenoo 7,316 on at
    RE: Rollup field calculation not working

    Yes, the unsaved changes error comes up for both business rule and script. I am trying to find a workaround for this.

    One other strange issue I'm facing is, not sure if you have any answer for it.. but

    The rollup field works only for new records and won't work for the existing records. I mean, for example, I have lots of cases already in the system where this rollup field was created on. It won't calculate for the existing cases and it's child records.

    Works only if I create a new case and add child records with amount entered in them.

    What do you think the reason could be? Please let me know your thoughts.. it will be big help for me to work through this.

    Thanks.

  • Neil Parkhurst Profile Picture
    Neil Parkhurst 10,725 User Group Leader on at
    RE: Rollup field calculation not working

    Hmmmmm .... I guess the reason is the business rule is updating the actual field when you click save. Causing an unsaved change. (You may have had the same thing effectively happening with your script. Although as the browser refresh solved the problem you script could have always been working!)

    I think I have seen something similar before but in my case I was updating the rolled up fields using a real time workflow. (You can get some workflow tools to do this on codeplex. https://msdyncrmworkflowtools.codeplex.com/)

    I wonder if you could avoid this issue by setting the actual value using a workflow and also if needed force the roll up.

    I think Melisa described rolled up fields as finicky. She is right as getting the timing bang on for the updates can be "finicky".  (Especially as you have calculated fields involved.)

  • Verified answer
    meenoo Profile Picture
    meenoo 7,316 on at
    RE: Rollup field calculation not working

    Ok, for some reason I thought of closing all the browsers and starting fresh did the trick!

    The rollup field is now working.

    Neil - I did build a business rule to set the hidden field which defaults to calculated amount on child entity instead of a script.

    But, the only small issue is, whenever I save the child entity for the first time.. I am seeing 'Unsaved Changes' in the bottom. And until I hit 'save' again, the rollup value won't update even if I click 'refresh' button. Any workaround surrounding this small issue??

    Thanks.

  • meenoo Profile Picture
    meenoo 7,316 on at
    RE: Rollup field calculation not working

    Thanks Melissa. I tried all your suggestions but still not working!

  • meenoo Profile Picture
    meenoo 7,316 on at
    RE: Rollup field calculation not working

    Thanks Neil. I did try creating a business rule to fill in the total in a hidden field. But it did not work as the 'Calculated total' field does not show up when I try to set it to the hidden field. I've tried to create business rule with scope as entity and the calculated field won't show up.

    So I had to write a script to fill in the hidden field.

    I've even tried setting up the rollup field to sum 'another' field(simple currency data type) of child entity and that won't work either. I am totally frustrated and not sure what else to try.

    Thanks.

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,240 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,149 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans