In this scenario our business requirement is that when a user creates a new Opportunity in the CRM system a default Price List is automatically set when the Opportunity is created.
[Set the price List Lookup on create event of a new Opportunity]
N52 Formula Manager Solution
The Formula Manager solution works like this,
- We create a server-side only formula that fires for just when a Opportunity gets created.
- The formula itself first looks up the guid of the price list by using the FindValue() function to lookup the guid by referencing its name 'Sage line 50 Price List'
- It then uses this to set the price list lookup field
Note : One big advantage of using the FindValue() function to lookup up the guid of the Price List is that when you deploy the formula to your Test, UAT, Production, etc. environments you don't need to do any additional steps. As even though the underlying guid will change from system to system the formula will just lookup the guid at runtime.
N52 Formula Manager Steps
The following set of steps assumes you are just using the out of the box Dynamics CRM setup.
- Create a new formula of type 'Save - to Current Record'
- Set the Event field to just 'Create'
- Set the Source Entity to 'Opportunity'
- Set the Source Entity Property to 'All Properties'
- Copy & paste the formula below into the formula description field
- Click Save
- You are now ready to test
SetLookup(FindValue('pricelevel', 'name', 'Sage Line 50 Price List', 'pricelevelid'))