1
votes

I wanted to create a new GUID field for an entity in the Dynamics CRM online. But surprisingly there is no data type for it.

Why is that? And what is the best option if I want to create a "reference" field to an external system? If it is "Single line of text" what is the best approach to ensure that entered values are proper GUIDs (from API point of view).

2

2 Answers

2
votes

If you want to ensure that the value entered inside a single line of text field is a GUID, you need to create a synchronous plugin on the create and update event of the field and throw an exception if the value is not a GUID.

You can do also this with a Workflow and a Custom Activity.

In addition to this plugin/workflow you can write a JavaScript attached to the OnChange event of the field that enforce the check when the field is updated by CRM Web UI.

0
votes

You could create a custom entity that represents your external system. Then it would be stored in CRM as a GUID, and you could run code on the create of the entity to set the name to be the GUID so it displays the GUID as well. Not sure if there is any benefit to the storage/searching/index of said field though, and you get to incure the expense of having a dummy entity in your CRM system, so I'm not sure I'd recommend it...