I have previously created several posts about agent scripts within Unified Service Desk (USD) for Microsoft Dynamics CRM. I wanted to complete this “series” by mentioning conditions.
Conditions on agent scripts can be very useful as you may only want certain options to display in certain situations. For example, a script answer to give out information on a case maybe only needed if the case subject is “Information”.
You can see below that I have added an enable and visible condition to my agent script. I have opted for a simple approach of just setting both conditions to the same. But you could have different conditions Maybe you’d like the option to be visible but only enable in some circumstances!
The condition I used is;
"[[$Context.InitialEntity]]"=="incident" && "[[incident.Id]]" != "" && "[[incident.subjectid.name]]"=="Information"
This is actually more complex than I really needed. But I wanted to show some possibilities.
“[[$Context.InitialEntity]]”==”incident” … This can confirm that the active session contains an incident.
“[[incident.Id]]” != “” …. This is used to ensure I have a case ID. (As I would once the incident had been saved.)
“[[incident.subjectid.name]]”==”Information” …. Finally, the important check that the subject of the case if “information”