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”

6 responses to “USD – Agent Script Conditions”

  1. Hi sir,

    Can we also use Agent Script Conditions to stop agent script to get loaded for a particular type of sessions (like case session) ? If yes, then how ?

    Like

    1. I have recently seen a product bug with the conditions on agent scripts! Simple conditions seem to work but proper comparisons of fields don’t work. However in the example you give I suspect you could get round this by adding the condition to the GotoTask action that triggers the agent script.

      Like

  2. Hi Neil,

    Great blog. I am playing around with conditions on actions which isn’t exactly related to this post, but want to get your take on it. I have used conditions successfully and now I am trying to create one that only allows action calls to fire 1 time per session. I’m assuming if we can create this sort of condition it could be used on every action call that fires in a session.

    I think it will probably take a combination of both scriplet and condition, but not quite sure of the best approach here. Have you come across this scenario?

    Thanks in advance.

    Like

    1. You have a few options!

      One is to simply include your action in the event we have on Global manager “session new”! That is only triggered when a session starts.

      Next you could add a condition on the action that only runs the action if a value in the context isn’t set. Then add a sub action to the action to copy the value into the context. The sub action will run if the action is successful, so on first run the action would fire. But on second run the condition would stop it running.

      Hope this helps

      Neil.

      Like

Leave a comment

Trending

Website Powered by WordPress.com.