Scenario Overview
In this scenario our business requirement is that when a user in on the contact entity and changes the parent account (Company) field then all the Contact Preferences details from the new parent account needs to be copied down to the contact.
Change the Company field on the form (i.e. onChange event invoked)
Then all the Contact Preferences from the new Company are copied down to the Contact record.
N52 Decision Table Solution
The Decision Table solution works like this:
- We create a client-side only Decision Table that fires for just when the Company Name lookup field changes
- The formula itself retrieves all the contact preferences associated via the Company Name (i.e. parentcustomerid) field on the contact entity
- It then matches and sets each of the field names and values
N52 Decision Table Steps
The following set of steps assumes you are just using the out of the box Dynamics 365 setup. But its easy to enhance if you have extra fields or requirements.
- Create a new formula of type 'ClientSide - Perform Action'
- Set Event to 'Create & Update'
- Set Source Entity to 'Contact'
- Set Source Property to 'Company Name' for the Contact form Events
- If the Decision Table editor is not displayed, click on the Commands menu and select Toggle Editor
- Delete the Condition column: Click on a cell in the Condition column, right-click and from the context menu select Delete Column
- Right-click on the Action column and select Insert Action
- Repeat until you have 6 Action columns.
- Click cell A4 in the first Action column and then go to the Source tab
- Search for 'preferred' and expand the Source node
- Select Preferred Method of Contact {Value}
- Click on the + icon located in the top-right of the Decision Table editor and as highlighted in the image below and click into the Formula Manager editor canvas that expands
- Go to the Source Tab and collapse the Source node
- Clear the search bar and press Enter to reset the search
- Expand the node Related (N : 1) > Account (parentcustomerid) > (Attributes)
- Enter 'preferred' in the search box
- Select 'Prefered Method of Contact {Value} '
- Click on the X icon to collapse the Formula Manager editor
- The formula value is now shown in the cell under Preferred Method of Contact in the Decision Table
- Your Decision Table should look like below:
We will now do this for the other 5 columns:
- Click on the empty cell below the next Action-Update
- Click on the Source tab
- Search for 'Do not' and expand the Source node
- Click on Do not allow Bulk Emails (Value)
- Click on the empty cell below in the Decision Table.
- Click on the + icon located in the top-right of the Decision Table editor and click into the Formula Manager editor canvas that expands
- Go to the Source Tab and collapse the Source node
- Expand the node Related (N : 1) > Account (parentcustomerid) > (Attributes)
- Select Do not allow Bulk Emails (Value)
- Repeat the last 9 steps for Do not allow Emails , Do not allow Phone Calls, Do not allow Faxes and Do not allow Mails
- Your final Decision Table should look like below:
Finally, you will need to Publish the formula from the N52 Commands menu and then test.