In Omnichannel, Agent Scripts are step-by-step instructions that agents can follow to ensure interactions with customers are handled systematically and properly. Macros are automated actions that can help complete tasks. In this post, we will look at how to use Agents Scripts and Macros in Omnichannel.
Also check out the YouTube video on PowerPlatformTV:
Let’s go to the Customer Service admin center app and go to Agent Experience->Productivity. We see Agent Scripts and Macros:
Let’s look at each of these, starting with Macros. Click on Manage next to Macros, then click New to create a new macro:
The macro page opens, and we see we can enter the name and description of the macro. We also see what looks like a Power Automate Flow that will perform the macro:
Let’s select Productivity Automation, then Start Macro Execution:
We now have the trigger defined, let’s add a new step:
At this point, we get to choose an action:
The actions available are:
- Refresh the session context
- Focus on the tab
- Refresh the tab
- Get the current tab
- Open application tab
- Open a record guid
- Clone current record
- Do a relevance search based on the phrase
- Search the knowledge base for the populated phrase
- Open an existing record
- Update an existing record
- Action to resolve case
- Open a new form to create a record
- Save the record
- Open an email form with predefined template
- Autofill form fields
- Open knowledge base Article
- Clone input record
- Send KB article in chat
- Unlink record from conversation
- Link record to conversation
- Run flow
Let’s try Open an Existing Record:
We’re prompted to enter the entity logical name, the record id, and optionally the form id:
In this area, we can use slugs. Some examples are:
- {anchor._customerid_value}
- {anchor.title}
- {anchor.incidentid}
- {anchor._customerid_value@Microsoft.Dynamics.CRM.lookuplogicalname}
- {anchor._customerid_value@OData.Community.Display.V1.FormattedValue}
- {anchor.ticketnumber}
- {anchor.modifiedon}
- {anchor.description}
Let’s hardocde a value here to try it, a contact record:
Activate the record if prompted:
Now let’s attach this macro to an agent script so we can use it. Our chat is attached to a workstream, and the workstream has the default session template attached:
Click Create Session Template:
Click New:
Give the template a name, set to Generic, set the anchor tab, and save:
Click on the Agent Scripts tab, then add existing agent script:
Select New Agent Script:
Enter below and save:
Add a new Agent Script Step:
Enter below and save. You can see we are selecting action type = macro and selecting the macro we created earlier:
The step should now be on the agent script. Add the script to the session template:
And add the new session template to the workstream:
Now let’s test this. When a new chat is initiated and routed to an agent, the agent below in the Agent Scripts. The Open Contact Record script has an icon next to it. Let’s click it:
On clicking, a new tab is opened and the contact record is displayed. Our agent script step is set to green and checked:
Let’s try some new agent script steps. Let’s rename the agent script to something more generic, New Customer Script:
And let’s go to Productivity->Macros, and add a new a new macro. We will add one that opens an Accounts view. Note the View Id provided, which you can get from opening the view in the Power Apps Maker portal:
Now let’s try Do Relevance Search for the word “coffee”:
Let’s search KB for “water”:
Update an account record’s ticker symbol field:
Open and Save a Lead, providing a slug value:
And let’s create one that calls a Flow. First let’s create a Flow on the Lead entity on record selected:
Now let’s link this flow to our macro:
We will hardcode the Id of a Lead for this demo:
Now we need to add each of these macros to an agent script step, then apply the steps to the agent script:
We will also create a new step of type “Text” to remind the agent to say thanks to the customer:
Now let’s run this. The agent script opens like this:
Clicking each step, each action is performed:
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
Can you start an agent script with JS,,,,, say onload or onchange?