Creating Lookup Attributes in CRM 2011/2013

Starting from MS CRM 2011, we are able to create lookup attributes from the list of Fields in the entity instead of creating from N:1 Relationships. We can still create the lookup attribute as in the old way by creating from N:1 relationship but here are the reasons why it is better to create the lookup attributes.

If you create from relationship, the Auditing of the attribute is “Disable” by default while the default value is “Enable” when the attribute is created from the list of Fields. In the projects that I designed and configured I usually keep Auditing enabled for all attributes and I just control the Auditing setting for the whole system or for each entity based on the requirement. (unless there is a requirement not to audit the specific attributes). So, if we happen to create some of the lookup attributes from the relationship, Auditing was left disabled and we might only realise until the audit history value of the specific lookup attribute is nowhere to be found. And at that time, you might have to check the list of fields for all entities and check the Auditing setting for each attribute to ensure any other lookup attributes are not missing out. In my case, I used the excellent Audit Center tool by Tanguy Touzard to quickly look thorough all the entities which are enabled for Auditing.

If you create the lookup attributes from the list of Fields, all the configuration values in the relationship are exactly same as the default values and if the requirement is different from the default values, you can easily click on the link “Edit relationship detail(advanced)” after saving the attribute.

If you create the lookup attributes from the list of Fields, the relationship name is postfixed by the attribute name which is a better naming convention especially when you have multiple relationships to the same parent entity. (e.g. Implementer lookup and Approver lookup to System User entity)

Did you know that the number of characters allowed for the Schema Name and Relationship Name of the attribute are not the same for the Field form and Relationship form. The maximum length of characters allowed for the Schema Name in Field form is 41 while the Relationship form only allows 31 characters. It is also different for Relationship Name as Field form allows 96 characters while Relationship form only allows 41. (*The numbers of characters mentioned are based on the 3 character prefix of the custom fields setting in Publisher). I am not sure why is it different so but the issue is still there in CRM 2013 latest rollup.

For all the reasons above, I just keep my habit to create lookup attributes from the list of Fields if I need to create one from CRM interface. Lately, I’ve been creating in bulk from csv file by developing one plugin xRM ToolBox. I’ll share it to the rest of you when it is ready to be used by the public.
Let me know in the comment section if you have any point which agrees/disagrees with my opinion.

Comments

Popular Posts