Tuesday, December 11, 2012

CRM fields and "Duplicate Field Name” error

Every time you create an option set or a lookup field in CRM, the system creates 2 fields. For example if you create a lookup field named “new_contact”, the system will create the following 2 fields:

  • “new_contact”
  • “new_contactname” ( the second field will have “name” at the end)

The first field is created as expected. But the system creates the second field automatically. If you ever looked into the filtered views, you must have noticed the extra name columns for lookup and option set fields. If you open a FilteredAccount view, you will notice primarycontactid and primarycontactidname columns. The primarycontactid column contains the guid of the primary contact and primarycontactidname contains the actual name of the contact.

In case of optionset field, the first field contains the integer value of the optionset and second field contains the optionset text value.

The problem is that the CRM UI does not display the second field. You won’t find primaryconactidname in the field’s grid of account entity.

To verify this behaviour, I created a lookup field name “new_contact” and then I tried to create a new field “new_contactname”. I received the following error message.

image

If you receive the “Duplicate Field Name” error, the reason can be a existing lookup or optionset field as explained above.

2 comments:

  1. Thanks Amreek... I want to say that I encountered this problem and I was puzzled as to why I'm getting the duplicate error especially when the UI does't show the duplicate field!! Thanks to you, now I know why.

    ReplyDelete