Slug expression in Agent Scripts and Macros in Dynamics 365 Customer Service Workspace

If you are struggling to figure out how to show customer name or any lookup text/value in the Agent Scripts or Macros dynamically then this post will surely save some of your time. As usual you must be exploring microsoft docs article where you must have tried multiple expressions like ${customerName}, ${anchor.customerName}, ${$session.customerName} to show Customer name in the Agent script step as mentioned in Microsoft article but I am sure you will not get the expected output rather you will end up getting this weird error message “Missing entity id in query“.

So long story short, use below expression in your agent scripts to get lookup values, ex. for customer field,

Name: ${anchor._customerid_value@OData.Community.Display.V1.FormattedValue}
ID: ${anchor._customerid_value}
Type: ${anchor._customerid_value@Microsoft.Dynamics.CRM.lookuplogicalname}

or within macros

Hope it saves some of your time and Thanks to @nerdynat for helping me here.

Cheers!

Leave a comment