Customer Service Workspace – Marco to create, save and link a case

In Microsoft’s Customer Service Workspace App we can use a combination of agent scripts and macros to create automations that can aid agent productivity. In this post I will explain one example of how these might be used to create a case.

This information is aimed at Microsoft’s multisession experiences within Dynamics 365. Specifically meaning their Omnichannel for Customer Service App or Customer Service Workspace (CSW) App. I will generally be using Customer Service Workspace (CSW)!

What is the Productive Pane?

The productivity pane in CSW gives our agents the ability to quickly access tools which are designed to aid them with solving customer queries. Options include Microsoft Teams collaboration, Agent scripts (today’s topic), Knowledge search and smart assistant.

Administrators can enable or disable individual features available in the productivity pane using the “App profile manager”. Below you can see that I have enabled pretty much all the possible productivity pane features in my app profile.

If you aren’t familiar with the app profile manager, you can read an overview here.

Below you can see how my customer pane appears in my CSW app.

What is an Agent Script?

An agent script can do several things …

  • In their simplest form they can be used to present text to an agent giving pointers on what to say to a customer. Or maybe even full details the agent must read. (Consider the wording of a regulatory directive that must be accurately read to a customer before purchasing a particular product or service.)
  • Agent scripts can trigger macros, these can then be used to automate the creation of records and other tasks the agent may need to execute.
  • Another option is for one agent script to link to a another set of scripts. This might be useful in complex scenarios when the agent would effectively pick the topic of a query. That script could link to a second script give further options.

In this post I am going to focus on using an agent script to trigger a macro.

You maintain agent scripts with the “Omnichannel admin center”. You will find the “Agent experience” option under “advanced settings”. Within here you can use the “manage” link to option for agent scripts.

Below you can see that I have created two different agent scripts.

Quick tip: You govern which agent script loads when a session starts by maintaining your session templates. Then the workstreams for each channel are linked to your session template.

You can see that I have added several steps to one of my agent scripts. Some steps simply show text to the agent, some run a macro and some trigger the display of another agent script. In this post I want to concentrate on my agent script that has been created to create a case.

If we edit that agent script, we can see that it calls a macro called “Create Incident”.

What is a Macro?

We have seen that an agent script can call a macro. But what is a marco and how can we maintain one?

A macro is simply a list of actions that will be performed when they are triggered from an agent script.

You’ll find the macros option below agent scripts in the agent experience area of the omnichannel admin center.

When you open a macro, you will see that they look very similar to a Cloud Flow. (But they aren’t Power Automates!) They share the same concept of actions.

My macro is simply a list of actions that will be performed when they are triggered from an agent script. Often your actions will work in a linear way (as I have shown above) but conditions are possible to further refine what actions are run when.

When you add an action, you can select between “predefined automation actions” and “built-in” actions. Use the built-in actions tab if you need to add a condition into your macro!

The predefined actions are grouped under the four headings of flow connector, omnichannel connector, productivity automation and session connector. Each of these groups of actions gives you options to automate your agent’s experience.

Flow Connector option gives us an action that allows us to trigger an instant flow. We simply need to provide the entity and record details plus the name of the flow to run. I think this is a very powerful option and I might create a later blog post that explains how this can be used!

The “Omnichannel Connector” option gives us three actions, all specific to being engaged in an active conversation with a customer;

  • Send KB article in chat
  • Unlink record from the conversation
  • Link record to the conversation

The “productivity automation” option provides a set of actions that might be used to help our agents. Including;

  • Search the knowledge base for the populated phrase
  • Update an existing record
  • Open an email form with predefined template
  • Save the record
  • Open knowledge base article
  • Open a record grid
  • Open an existing record
  • Clone current record
  • Clone input record
  • Action to resolve case
  • Autofill form fields
  • Open a new form to create a record
  • Do a relevance search based on the phrase

Finally, we have session connector actions, all of which govern how tabs / sessions behave. Actions include;

  • Focus on a tab
  • Refresh the session context
  • Open application tab
  • Get the current tab
  • Refresh the tab

I hope you can see that we have quite a lot of actions available to us. Which can be combined to create custom macros to complete many different automations that might help our agents.

My Macro to create a case

To really understand macros creating an example might be the best way to learn about them. So below I will describe the details of my marco which creates cases.

I do more than just create a case, as the record is saved and linked to the current conversation automatically. Meaning my macro has four steps.

I will describe each of my actions in more detail below.

Start macro execution

you always have this step! As this is simply the point that the marco is triggered. (If you are familiar with Power Automate you may be familiar with the concept that we always have a trigger at the start of our action list.)

Open a new form to create a record

This action opens a tab contains a form. So, I simply supply the name of the table to load. In my example of creating a case I give the schema name of “incident”.

I could have also provided the ID of a particular form to load. But I only have one case form, so this field can be left blank.

I then click the “show advanced options” to add more detail. As I didn’t want to just open a form, I wanted to pre-populate as many details as possible for my agents.

The advanced options are made up of a list of attributes that provide the name and value for each one. The first attribute I set on my case is the title. Meaning my attribute name is “title” and the value is a definition of the title I want.

For my value I have entered “Case for ${customerEntityName} – ${customerName}“. Here I am using “slugs” which will be replaced by values at run time. My title will end up looking something like “Case for contact – Neil Parkhurst” or “Case for account – NP Dynamics Limited”. As the type of entity used for the customer and their name will be substituted when the macro is run.

Next I wanted to default the customer on the case. That is a little more involved! As I need to provide values for the ID of the customer, the type of record and the name of the customer. So I actually set three attributes of “customerid”, “customeridtype” and “customeridname”. You can see how I set all three of these attributes below. The slugs I am using refer to the customer that will “hopefully” already be linked to my conversation.

I next decided to default the description on my case. As this was a test I wanted to include as much information as I could from the various slugs we have available. My test description is shown below;

To help illustrate the slugs that I added to my description I have shown the details of my description field below.


Customer Name: ${customerName}

CustomerEntityName: ${customerEntityName}

CustomerRecordID: ${customerRecordId}


QueueId = ${queueId}

Language: ${visitorLanguage}

Location: ${visitorLocation}

Device: ${visitorDevice}

City: ${visitorCity}

Locale: ${visitorLocale}


Name: ${Name} (FYI …. Your names may differ!)

Email: ${Email}

Consent: ${Consent}

Save the record

As I have completed all the mandatory fields on the case, I next wanty to save the record. And then I will be ready to link this record to the current conversation.

Tip: If you try a save action and not all the mandatory fields are completed then the save will fail.

Apart from that the save action is very simple. As it required no additional parameters.

Link record to the conversation

My final action links the newly saved record to the conversation. Meaning people view this case will find it easy to identify the initial conversation and if required open the conversation to review the chat transcript etc. My link record to conversation action requires the name, ID and record type of the entity to link.

Below you can see that I have used the “Add dynamics content” option and then selected the values corresponding to my “save the record” action. Resulting in the newly saved record being linked to the conversation.

Hopefully I have managed to provide a typical example of how we might use agent scripts and macros combined to aid agent productivity. I am sure you can adapt this concept for many other purposes! Enjoy.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s