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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Calculated Rollup Aggr...
Power Apps
Answered

Calculated Rollup Aggregation in Powerapps Model Driven

(0) ShareShare
ReportReport
Posted on by 37

Hi All,

 

What's the best method to support the calculated rollup aggregation in Model Driven apps with low latency and more real time view.

 

The OOB method doesn't meet the business needs/requirements. Please suggest alternatives.

 

Can plugin be used to update the summary count in a post operation method.

 

Thanks

 

Categories:
I have the same question (0)
  • Verified answer
    mtoma Profile Picture
    Microsoft Employee on at

    Hi @manishsg ,

     

    Thank you for the post.

     

    Regarding the calculation of rollup fields, there are different methods of doing this, however there is a limitation behind it, you can not trigger the calculation of rollups based on the rollup calculation.

    You can trigger a flow at a certain time and from there you can send an Web API request as a Http request, here's an example of a script being able to perform this action, please remove the line numbers and adapt it to the requirements you have in the Power Automate infrastructure, keeping in mind the number of records retrieved during this operation needs to be below a certain limit, otherwise the Power Automate won't be able to update them:

    1. var Sdk = window.Sdk || {};
    2.
    3. Sdk.CalculateRollupFieldRequest = function (target, fieldName) {
    4. this.Target = target;
    5. this.FieldName = fieldName;
    6. };
    7.
    8. Sdk.CalculateRollupFieldRequest.prototype.getMetadata = function () {
    9. return {
    10. boundParameter: null,
    11. parameterTypes: {
    12. "Target": {
    13. "typeName": "mscrm.crmbaseentity",
    14. "structuralProperty": 5
    15. },
    16. "FieldName": {
    17. "typeName": "Edm.String",
    18. "structuralProperty": 1
    19. }
    20. },
    21. operationType: 1,
    22. operationName: "CalculateRollupField"
    23. };
    24. };
    25.
    26. function myTestFunction() {
    27.
    28. //create variables to point to a quote record and to a specific field
    29. var quoteId = {
    30. "@odata.type": "Microsoft.Dynamics.CRM.quote",
    31. "quoteid": "GUID" // add in here your record ID or parametrize this in order for it to be retrieved
    32. };
    33. var fieldName = "field_name"; // add in here your field schema name
    34.
    35. //create variable calculateRollupFieldRequest and pass those variables created above
    36. var calculateRollupFieldRequest = new Sdk.CalculateRollupFieldRequest(quoteId, fieldName);
    37.
    38. // Use the request object to execute the function
    39. Xrm.WebApi.online.execute(calculateRollupFieldRequest).then(
    40. function (result) {
    41. if (result.ok) {
    42. result.json().then(
    43. function (response) {
    44. console.log("The response is: %s", response);
    45. });
    46. }
    47. },
    48. function (error) {
    49. console.log(error.message);
    50. // handle error conditions
    51. });
    52. }

     

    Also you can have that request being sent by an external endpoint using Web API but first you need to make sure you had logged in successfully.

     

    You can even trigger this as a plugin on update for that particular entity post-operation, but you need to make sure your request will not be throttled due to too many requests in a short period of time, regardless of the method you want to use. 

     

    The documentation of the CalculateRollupFieldRequest is available here:

    https://docs.microsoft.com/en-us/dotnet/api/microsoft.crm.sdk.messages.calculaterollupfieldrequest?view=dynamics-general-ce-9

     

    Thank you for using Microsoft Communities,

    Madalina Toma
    Support Engineer
    Microsoft Dynamics 365

  • manishsg Profile Picture
    37 on at

    Thank you. Amazing response. Keep it up.

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 577

#2
WarrenBelz Profile Picture

WarrenBelz 440 Most Valuable Professional

#3
Haque Profile Picture

Haque 308

Last 30 days Overall leaderboard