Friday, May 20, 2016

When to use a Global Option Set vs. a Custom entity

Reference - 
One of the great features in MS Dynamics CRM 2011 is Global Option sets. A global option set, sometimes called a global pick list, provides a common set of options that can be used by multiple entities to set attributes. This is a great feature but there is a draw back from using the Global Option set instead of a custom entity. If a user or organization decides to change or delete those values in the option set, the existing data that was entered using those values will be deleted from the system. If those values will be changing, the best approach would be to use a custom entity. This will change the look of the field from a drop down menu to a lookup but the advantage of using the custom entity is that you have the ability to “deactivate” a record instead of deleting it. Now if the user or organization were to delete the record from the custom entity you would still have the same issue with the Global Option Set. Another benefit is that you have the ability to activate the record if you ever decide to use that value again.
In this example for MSCRM, we will walk through creating a Global Option set, a custom entity for a lookup as well as show you how to deactivate a record within the custom entity.
The organization wants to track where the lead source came from on the Lead entity as well as have the same option on the account entity in case the user creates the account instead of a lead.
Global Option Set
To create a Global Option set, go to the Customizations, select Option Set from the left navigation and when the Option Sets menu appears select, “New”.
Enter in a display name and add the options you wish to have available. In our example the display name will be “Lead Source” and our options will be Web, Walk in, Referral – Customer, Referral –Employee and Trade Show.
To add this option to the form, Select Entity from the Left Navigation and then select which entity you want to add this Global Options set to.
Note: There are multiple ways to create the field and add it to the form. We are going to create the field by adding it through the form design.
Double click on the form you wish to add the field to.
When the form opens, select “New Field” in the lower right hand corner.
Enter in a display name and then select “Option Set” from the Type drop down. Then make sure to select yes to use an existing Option Set. Once that option has been selected, you will receive a drop down list of all of the Global Option sets that are available. Select the appropriate option set. Lastly, you can select a default value if you desire. Once the field has been created, you can now add it to the form.
Custom Entity
To create a custom entity, go to the Customizations, select Entities from the left navigation and when the Entity menu appears select, “New”.
Define the Display Name, Plural Name, Ownership, Areas to display and then the options for Entity. You can also define the Primary Field which we will call “Lead Source”.
Now that the custom entity has been created, we can add the lookup to the form. We will go through the same steps as described above but this time we will select “Lookup” for the type and the target Record type will be the Lead Source entity we created.
We now can create the values that are needed for the lookup in the Lead Source Entity.
We now want to remove a value from the lookup. To do this simple open the record you wish to no longer be used. The select the “Deactivate” button from the Ribbon entity.
You will receive a confirmation message and select “Ok”.
As you can see now the record is now in the inactive view list.
This record is no longer available to be selected when creating or updating a record.
Are you using Global Option Sets in your MSCRM? Let us know if this was a useful hint or have something to add.

No comments:

Post a Comment