I got reminded of this best practice twice recently.
Once by a fellow developer and then I also came across these advise whilst studying for the MB2-703 – CRM 2013 customization and configuration exam.
The advice is when you create a field of type lookup then you should add an ID suffix to the field e.g.
Primary Contact
primarycontactid
Why should you do this?
The reason is it makes it obvious the field is a lookup and not a text, optionset or integer. below the screenshot shows you how it makes the lookup easy to spot
When a developer is writing some code then lookup fields are usually EntityReference fields and these have a few different values
Entity Logical name
Guid
When the developer see’s the ID suffix they will know it’s a lookup and the ID will remind them it basically the guid of a record and they can use this field to retrieve the other fields.
Common Code
Another reason for using this naming system, Microsoft do this so it will mean your fields are similar to Microsoft and as it’s a best practice when you work on other projects with different developers they will hopefully do this as well.
4 thoughts on “Hosk CRM Dev Tip – add ID suffix to lookup fields”