Rollup fields in Power Apps.

Hello Guys,

In my previous blog we have seen how you can use OOB feature of the Dynamics CRM i.e. Calculated Fields. Today we will see one more field which is nothing but the Rollup field. But before if you are new to our blog then do follow us to know more about Dynamics and Power Platform. Also if you like our blog then please comment and share this blog with your friends.

Rollup fields were introduced with Microsoft Dynamics 2015. A rollup field contains aggregated value calculated from child records for a parent record.

For example, Active products for a company, Open opportunities for an account, Total customer for a particular account etc.

Consider Department and Employee entity which are related to each other as in particular department we are having some employees. Now we want to calculate total no. of employees in each department, Maximum and Minimum salary of the employee in that department etc. So in this scenario we need to create rollup fields.

While working with rollup fields we need to keep this in mind that Dynamics 365 creates two asynchronous recurring system jobs as below when new rollup fields is created for an entity.

  • Mass Calculate Rollup Field: This job is created per Rollup and runs when you create or update rollup field. By default , job runs in 12 hours after you create or update rollup field. You can adjust start time of the this job to make sure job runs during non-operational hours.
  • Calculate Rollup Field:One job per entity and gets created when first rollup field is created for an entity and deleted when last rollup field is deleted. This job is responsible for incremental calculation for all rollup fields in an entity after mass calculate rollup field job finishes execution. By default this job is scheduled to run every hour which is maximum recurrence setting.
You can monitor these two jobs under System Jobs Entity using "Recurring System Jobs" View.

You can have 100 rollup fields per organization and 10 per entity at max. You can trigger workflow on change of the rollup field value. Rollup field can not refer another rollup field. These fields are not supported in offline mode while working with mobile or tablet. The maximum number of records during the rollup refresh is limited to 5000. if this limit exceeds, you will see an error.

We will create some rollup fields on Department entity which will be using related employees to calculate count,maximum and minimum salary, average salary. Follow below steps:

Step 1:- Navigate to https://make.powerapps.com.



Step 2:- Open Department Entity.



Step 3:- Add New field. Configure it as below and click on Add and select Rollup.



Step 4:- It will create a new window as below.Configure it as below.





Step 5:- Drag this field on Department Form. Save and publish the customization



Here we have below employees.










Now we will open IT Department record and check the result.



You can also use other aggregate functions like MAX, MIN,AVG,SUM etc.

Please follow and share if you like it.
Hope it helps... 

Comments

Post a Comment

Popular posts from this blog

Creating Custom API in D365.

Read Only Sub Grid & Editable Sub grid in Dynamics 365

Using Polymorphic Lookups in D365.