web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Dynamics 365 Community / Blogs / Hosk's Dynamic CRM Blog / Hosk CRM Dev Tip – add ID s...

Hosk CRM Dev Tip – add ID suffix to lookup fields

Hosk Profile Picture Hosk

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

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

primarycontactID 1

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.

 


Filed under: CRM 2011, CRM 2013, Hosk CRM Dev, Hosk’s Microsoft Dynamic CRM Development

This was originally posted here.

Comments

*This post is locked for comments