When integrating or importing data it is often the case that a new value for an option set will cause errors. For example when importing contacts we may set the account role code to the standard values. For example accountrolecode is an option set for the contact entity. DS3 allows you to treat Option Sets like any other entity. You can preview them, update them and use them in lookups.
The current accountrolecode contains the following items:
The data we want to import contains the following data with obviously a new value ‘Consultant'.
We can either create a new external lookup in a file or table with a list of acceptable accountrolevalues or directly synchronise from the source the values of the role into the option set value. The second option is preferable in most circumstances. In this case, before we synchronise the data into Dynamics CRM, we are going to synchronise in the distinct values of the role column using the following steps:
6.Compare the source and target
Note: If you wanted to delete an option set value using synchronisation you are going to have to publish the entity as deletes do not get published automatically.
Using the Option Set value during a synchronisation
In our example we wanted to import come contacts and set the accountrolecode to the correct value depending on the value in the Role column of the data source. We can achieve this in two ways.
Using an Option Set as a lookup using drag and drop
Option Set lookups work exactly the same as normal lookups, just drag and drop them onto the column you are using to lookup with.
Using a calculated column Lookup Function
Calculated column lookup functions differ from normal Lookup functions by using a special convention to indicate that the data source is an Option Set related to an entity.
For example if you were going to create a lookup using ‘Company' column to find the accountid of an account with the same name we would use the following if the CRM was on the B side:
But in this case we want to find the id of a option set accountrolecode with the same name as our role code:
As you can see from this example we have referenced the option set of the entity by using the convention entity|optionsetname.