web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Rollup field calculation not working

(0) ShareShare
ReportReport
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

I have the same question (0)
  • Yoya Profile Picture
    30 on at

    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
    38 on at

    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
    1,603 on at

    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
    on at

    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
    7,316 on at

    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
    7,316 on at

    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
    10,727 User Group Leader on at

    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
    7,316 on at

    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
    7,316 on at

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

  • meenoo Profile Picture
    7,316 on at

    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

News and Announcements

Season of Giving Solutions is Here!

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
Shidin Haridas Profile Picture

Shidin Haridas 2

#2
Abdullah13 Profile Picture

Abdullah13 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans