Sum of child MDF records using Integration Center
Happy new year friends. I want to begin 2021 with some exciting news especially around pressing requirements like getting sum of Child MDF records.
The following can be use cases
- Tuition Reimbursement – The sum of fees for various courses is usually stored as child records for a user. We would need to capture the total sum of these records in order to send total amount for reimbursement to payroll
- Time accruals – In some cases, customers would like to use past experience or past seniority from your old employments/companies in accrual scenarios along with current seniority in the current company.
And there are countless number of similar cases. The good news is that we can achieve this using Integration Center.
Steps to be followed
Previous experience MDF
Build your custom MDF. Parent MDF should have a field denoting the total field. Then link your parent with child (for which you need the sum)
In the above, we have a parent MDF cust_previous Emp which has user as external code and a total field
The Child MDF has Seniority items or previous employment records with a numerical field “number of years” in each company
You can notice that currently, the total field is empty as we currently do not have a rule function to calculate the required sum from child MDF records.
Using the Integration center we will calculate the sum of the number of years and put the result in Total Field.
Build an Integration Center Scenario (SF to SF Odata)
The source and destination entities are the same i.e Your custom MDF. In this case cust_previous_emp
Map the user field i.e external code from the MDF to External code of Destination object
In the destination field cust_Total , add a calculation as shown below
The operator used here is For Each Entity and this operation is used in cust_sernioity_items (which is nothing but the Child MDF where the numerical field “Number of Years” is present.
This will loop through each child’s record and add the field value from “Number of Years”.
The total is then stored under “Total” Field of Parent MDF
Run the integration and observe the log
- Instead of storing the total amount in the same MDF, you can also choose to store in another MDF or Hris Entity like Employment Details.
- Recommend to add time-based filters in the Integration Center Definition to only read recently modified or created MDF records. This will improve the performance.
- Since this is not real-time, you can always schedule the Integration Job as per your needs.
Hope this is useful for your implementations
This is really helpful, Awesome blog Neelesh.
Thanks for the feedback Shashank
This is really helpful Neelesh. Thanks! also if it could be possible to use Background elements instead of child MFD objects in integration center? Will this be possible.
Dont think thats possible. as BG is not configured as a child object of user.