In this scenario our business requirement is that when an accounts address is updated you need to update all the related contact addresses with the same data. The scenario involves the synchronization of fields between entities where a one to many (1:N) relationship exists.
However there are up to 200+ contacts and the syncing will take too long to process in real-time, therefore we want to run this process asynchronously in the background.
N52 Formula Manager Solution
The Formula Manager solution works like this:
- We create a formula that fires for just updates on the account entity where any of the address fields change
- The formula itself retrieves all the contacts associated via the parentcustomerid field on the contact entity
- It will then loop over all the contacts and update the address information with that of account entity
N52 Formula Manager Steps
The following set of steps assumes you are just using the out of the box Dynamics CRM setup. But its easy to enhance if you have extra fields/requirements.
- Create a new formula of type 'Save - Perform Action'
- Set the Event field to just 'Update'
- Set the Source Entity to 'Account'
- Set the Source Entity Property (hold down control key to multi-select) to 'Address 1 : Street 1 , Address 1 : Street 2, Address 1 : Street 3, Address 1 : City, Address 1 : Zip/Postal Code, Address 1 :Country/Region'
- Under Deployment Settings , set Pipeline Stage to 'Post-Operation (Asynchronous)'
- Copy & paste the formula below into the formula description field & click save
- You are ready to test
ForEachRecord( FindRecords('contact','parentcustomerid',[account.accountid],SetFindSelect('contactid'),'1000','true') , UpdateRecord('contact', CurrentRecord('contactid'), SetAttribute('address1_line1', [account.address1_line1]), SetAttribute('address1_line2', [account.address1_line2]), SetAttribute('address1_line3', [account.address1_line3]), SetAttribute('address1_city', [account.address1_city]), SetAttribute('address1_postalcode', [account.address1_postalcode]), SetAttribute('address1_country', [account.address1_country]) ) )
You can see the process executing under Settings > System Jobs. However, note that the system job will disappear when completed.