Dynamics365 is adding more and more features to help automate repetitive tasks for users in Customer Support product space. One of the latest additions is Agent Scripts and Macros in CS space.
Macro function has lots of options available however in this article, I am only focusing on Case related actions.
Before we begin, here are some basics:
Macro : An automation flow to perform specific tasks
Agent Script: A set of steps followed by an agent ( these steps can include macros as well)
Automation Dictionary – What we use to get context parameters such as Current Session, Current Tab, Current Case etc. If you are familiar with Power Automate and Logic Apps, this will be easy. However, if you are completely new to this, I have outlined every step required.
Basic steps are first create macros> then create agent scripts > add the scripts to the sessions > Run macro within Case tab
I will outline some of the common questions and answers below with examples:
Where do I find the Run Macro feature inside a case form?
Go to “Customer Service Workspace” > Press “SHIFT” key and click on any case record, it should open in a tab and on your right side, there will be a “Smart Assist” pane. You will find the “Agent Scripts” tab in there. You can run your scripts from there. Easy right?
A. How to create a new case with predefined parameters?
In this example, we will populate a new case form with below parameters – I am using common fields in the incident form for this.
- Title : “Case Creation Macro Test”
- Priority : High
- Status Reason : Pending
- Description : “This is a sample description “
- Go to https://make.powerapps.com and navigate to “Apps” tab
- Click on ellipses next to “Customer Service Workspace” and select “App profile manager”
3. Expand Customer Service Workspace group and select “Macros”
4. This will open the “Service Management Settings” screen
5. Click on “New” and Give a suitable name for your macro. Your first step is always “Start macro execution”.
6. Add new step and select “Productivity Automation > “Open a new form to create a record”
7. Entity logical name : incident ; you can leave the form ID as blank. This will open the default form.
8. Now open another browser tab and navigate to “https://make.powerapps.com” and open Data > Tables > Case and look at the column Name field. This is what we will need in order to populate case form fields
Here are the logical names of the fields we are using in this example :
Title : title Priority: prioritycode Status Reason: statuscode Description : description
Priority and Status Reason are Choice fields. Therefore, you need to get the option ids for the required fields. Here is how you can find the option id for Priority field.
For Pending Status reason, you may need to open the classic interface and get the status reason option id value.
Go to > Settings> Advanced Settings> Customizations > Customize the system > Entities > Case> Fields> Status Code > Select pending from the options list and click edit. In this scenario, Pending = 4
Now let’s go back to our macro
9. Add “Attribute Name” as the logical name of the field and “Attribute Value” as the field value that you need to populate.
Now the macro is completed. Save and close the macro
10. Go to Agent Scripts section
11. Add new agent script. Select appropriate name and Unique name should be according to below format
12. Save the record and now you will see “Agent script steps” list
13. Click on “Add new agent script step” and similar to the Agent script naming convention, provide the name and Unique name for the step. Select Action type as “Macro” and Target Macro as the macro created earlier.
14. Save and close the Agent script step
15. Go to Sessions > New Session template. Create a new template. Select the Type as Entity and Entity as Case.
16. Now go to “Agent Scripts” tab and click on “Add Existing Agent Script”
17. Once the agent script is added to the session template, enable the template as default by Setting the toggle to Yes
18. Save and close the session template.
19. Time to test. Go to “Customer Service Workspace” app in dynamics
20. Press shift and open any case.
21. Select the Agent script and click on the “Run ” button
22. New case form opens with the predefined parameters
You can configure the macro to populate any case field in the new form.
In the next post, let’s see how we can update an existing case using Macro functionality.