Looking for PowerObjects? Don’t worry, you’re in the right place! We’ve been part of HCL for several years, and we’ve now taken the final step in our acquisition journey: moving our website to the HCL domain. Nothing else is changing – we are still fanatically focused on Microsoft Business Applications!

PowerObjects Blog 

for Microsoft Business Applications


How to Derive and Expose a Record GUID on Your Forms using OOB Functionality

Post Author: Joe D365 |

Let's say you want a unique reference number for your Opportunity records in Dynamics 365. You could use PowerAutoNumber for a customizable reference number, although that isn't always an option. In today's blog, we'll show you how – in 16 easy steps! – to use a little configuration magic to derive and expose the guaranteed-unique record GUID as your reference number. Ready? Let's go…

  1. Go to Settings / Customizations / Customize the System.
  2. Expand Entities in the left-hand navigation and click on the Opportunity entity to expand it.
  3. Click Forms and open the form version on which you want the GUID to appear.
  4. Create a simple Single Line of Text field called "Record URL" as shown below:
  • In the "Display Name" field, type "Record URL"
  • In the "Data Type" field, select "Single Line of Text"
  • In the "Format" field, select "URL"But wait… why do you need the "Record URL"? Fair question. You need it because it contains the Record GUID text, which is what you're really after, right?
  1. Place this new field temporarily on the form (you'll need it there for unit testing J).
  2. Now create a calculated Single Line of Text field named "Record GUID" as shown below:
  • In the "Display Name" field, type "Record GUID"
  • In the "Data Type" field, select "Single Line of Text"
  • In the "Format" field, select "Text"
  • In the "Field Type" field, select "Calculated"
  1. After you change "Field Type" to "Calculated," the Edit button will expose. Click it to open the calculated field definition editor.
  2. This is where it gets fun! J For this example, let's assume that the URL for a new record in your DEV environment is as shown below, with the 36-character GUID highlighted:https://XYZsandbox.crm.dynamics.com/main.aspx?etc=1&histKey=995219974&id=739007ac-69f4-e611-8107-c4346bac1938&newWindow=true&pagetype=entityrecord#383951512You're going to add logic similar to what is shown below in the calculated field definition editor to slice out the GUID and put curly brackets on either side. The GUID is always 36 characters, including hyphens. The "stuff after the GUID" is always 55 characters. The "stuff before the GUID" is variable, dependent on the length of your CRM org.
  3. Click Save and close the calculated field definition editor, save the Opportunity form, click Publish, then close the Opportunity form editor.
  4. You'll be returned to the default solution; scroll down to the Processes area.
  5. Click New, name your real-time Opportunity workflow, and click OK.
  6. In the workflow editor, set the following properties:
  7. Click Add Step and select Update Record.
  8. Select "Record URL (Dynamic)" in the "Record URL" field.
  9. Click Save and Activate the workflow.
  10. After testing, you can remove the Record URL field from the form if you wish.

And that's it! Now you'll have the Record GUID on the form to use as a unique reference number! Pretty cool, right?

It might seem complicated, but it's really pretty straightforward. Just follow these instructions carefully and you'll be able to do it, no sweat.

Happy CRM'ing!

Joe CRM
By Joe D365
Joe D365 is a Microsoft Dynamics 365 superhero who runs on pure Dynamics adrenaline. As the face of PowerObjects, Joe D365’s mission is to reveal innovative ways to use Dynamics 365 and bring the application to more businesses and organizations around the world.

2 comments on “How to Derive and Expose a Record GUID on Your Forms using OOB Functionality”

  1. Thanks for this Joe! My problem is that CRM 2013 doesn't have the option for 'calculated' at the field types - do you happen to know how to work around this?

    Many thanks,
    Angie

PowerObjects Recommends