Now Available in Community - MBAS 2019 Presentation Videos
Catch the most popular sessions on demand and learn how Dynamics 365, Power BI, PowerApps, Microsoft Flow, and Excel are powering major transformations around the globe. | View Gallery
2019 release wave 2 Discover the latest updates to Dynamics 365Release overview guides and videos Release Plan | Early Access Availability
Ace your Dynamics 365 deployment with packaged services delivered by expert consultants. | Explore service offerings
Connect with the ISV success team on the latest roadmap, developer tool for AppSource certification, and ISV community engagements | ISV self-service portal
The FastTrack program is designed to help you accelerate your Dynamics 365 deployment with confidence.
FastTrack Program | Finance and Operations TechTalks | Customer Engagement TechTalks | Talent TechTalks
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.
Did you make sure your script is actually storing that other value? Make sure there's something there for the rollup to use.
And technically a rollup can reference a calculated field, just not a calculated field that references another calculated field: technet.microsoft.com/.../dn832162.aspx
Yes, the script is working fine. It fills in the value.. I'm sure about it.
And I am sorry, I wasn't clear earlier. Yes, my calculated field on child entity uses another calculated field in the aggregation. So I can't use it for rollup calculations.
As per this statement from the msdn article you pointed out.
•A rollup can't reference a calculated field that uses another calculated field, even if all the fields of the other calculated field are on the current entity
I found that in the database, the rollup field value is 'NULL' but 'fieldname_base' has the actual calculation. Also, 'fieldname_State' shows 1.
Not sure what else to try. Any other suggestions would be great.
This post describes rolled up fields, it might help.
I have certainly done something similar to you before. Rather than a script I used a business rule to copy the calculated value to an actual value field. Which was then rolled up.
My business rule had a scope of entity, a condition of if "calculated value" does not equal "actual value", in the action I had "set actual value to calculated value - 0"
the most logical explanation to your problem would be that the actual value hadn't been set by the script at the point you are refreshing the rolled up field. But I guess you have looked at that already. It could be there is something wrong with your script, maybe try a business rule instead.
Roll-ups are finicky. They are set to refresh every 24 hours; they don't automatically re-calculate on save or refresh of the page. Did you refresh the page or the roll-up field itself?
First, make your hidden fields visible to ensure they're populating correctly. Then save the case. Then click on the calculator next to the roll-up field and the refresh button on the field (to the far right of the roll-up field).
This may be obvious to you but you said this is your first try with roll-ups.
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 Melissa. I tried all your suggestions but still 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??
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.)
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.
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.
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.
I am not sure about the solution here, but would like to share my little RnD about Roll-up fieldshttps://vjcity.blogspot.com/2019/06/dissecting-rollup-fields-in-dynamic-365.html
Business Applications communities