Setting Lookup and Option Set Fields in USD Forms Using New_CRM_Page

Leave a comment

In Unified Service Desk, we can create a new entity using the New_CRM_Page action call. When we run this command, we can default fields on the new record. Setting these fields is pretty simple. Let’s look at how to set lookups and option sets fields.

Let’s say we want to create an Account record and set the Relationship Type option set and the Product Price List lookup fields:

Relationship Type:

And Product Price List looks like:

First, let’s find the name of the fields we’re setting by opening the customizations.

  • customertypecode
  • defaultpricelevelid

Next, we’ll need to know the entity name of the lookup field. For Product Price List, this is msdyn_projectpricelist:

Finally, let’s grab the GUID of a lookup field, e.g. B068786C-6908-EA11-A823-000D3A35B658. And for the Option Set, we can open the field properties to get the value we want to set to, in our case Partner = 5.

Now let’s open the USD Debugger and build the command:

LogicalName=account
defaultpricelevelid=EntityReference(msdyn_projectpricelist, "B068786C-6908-EA11-A823-000D3A35B658")
defaultpricelevelidname=CRM Service USA (Sample)
customertypecode=OptionSetValue(5)

Note to send the “name” field for the lookup – if this is not populated, the lookup field displays without text and only with the icon, like below:

Click to run the command:

The new record is opened with the fields defaulted:

 

THANKS FOR READING. BEFORE YOU LEAVE, I NEED YOUR HELP.
 

I AM SPENDING MORE TIME THESE DAYS CREATING YOUTUBE VIDEOS TO HELP PEOPLE LEARN THE MICROSOFT POWER PLATFORM.

IF YOU WOULD LIKE TO SEE HOW I BUILD APPS, OR FIND SOMETHING USEFUL READING MY BLOG, I WOULD REALLY APPRECIATE YOU SUBSCRIBING TO MY YOUTUBE CHANNEL.

THANK YOU, AND LET'S KEEP LEARNING TOGETHER.

CARL

https://www.youtube.com/carldesouza

 

ABOUT CARL DE SOUZA

Carl de Souza is a developer and architect focusing on Microsoft Dynamics 365, Power BI, Azure, and AI.

carldesouza.comLinkedIn Twitter | YouTube

 

Leave a Reply

Your email address will not be published. Required fields are marked *