- Subscribe to RSS Feed
- Mark as New
- Mark as Read
- Bookmark
- Subscribe
- Printer Friendly Page
- Report Inappropriate Content
I'm Forrest Falk, a ServiceNow Certified Master Architect. In this post, Ill share a CMA’s perspective on how to get our custom skill to be triggered automatically when it is assigned to an assignment group. Feel free to comment below with questions or suggestions.
View Part 2 here: Trigger a Custom Now Assist Skill via Flow - Part 2
Last time, we were able to use Now Assist to help us create the flow in flow designer. Let's finish setting up the flow so that it will automatically set the category on an Incident when it is changed to the "IT Support" assignment group.
Now you should be redirected to the flow. We can see that we have the Tigger of when an Incident is updated and then we Execute the skill. Click the 3 dots “…” to open up the Incident Updated trigger.
In the Incident updated trigger we see that whenever a record is updated on the incident table, is active, and the assignment group changes to blank it will update. While that is close, it is not exactly what we want. I am going to remove the duplicate assignment group condition and change it to when the assignment group changes to “IT Support”.
Here is the condition I ended up with. When an Incident is updated, active, and assignment group changes to “IT Support”.
Now let’s take a look at the skill. When I opened the skill it did not have the skill config set to “Set Incident Category”. I went ahead and selected, “Other” for the Workflow since that was where my skill was published and then selected “Set Incident Category” for the skill config.
***UPDATE: After posting this, I realized that I did not set the inputs for the Execute Skill and it was running my test data that you see in the screenshot. Here you would want to use the picker right of the short description and description fields to select the incident short description and description from the trigger step.
I realized that in my initial prompt to create the flow, I forgot to mention we wanted to update the incident record’s category. So, let’s add an update record action to the bottom of the flow by clicking “Action” in the suggested box. For the record field, select the record from the Trigger step. It should automatically fill out the Incident table. Under “Fields” select the Category field. Then select the script button just right of the field. We are going to create a script that will grab the value of the model_output variable from the JSON returned in our skill. The output from that variable is also in the format <label>:<value> so we will have to parse the value out.
Here is an example output from the Execute Skill step. If you are not familiar with it, the object is in JSON format. We will need to grab the response variable from the object and use JSON to parse the model_output.
{ "error": null,
"errorcode": null,
"provider": "Now LLM",
"response": "{\"model_output\": \"Hardware:hardware\"}",
"status": "success" };
Below is the script I came up with to grab the response variable from the object and use JSON to parse the model_output and only return the value of the category.
//Grab the response, parse it and then get the value of the model output.
var responseObj = JSON.parse(fd_data._1__execute_skill.output.response);
var modelOutput = responseObj.model_output;
return modelOutput.split(':')[1];
Now let’s go back to the Incident and make sure the category and assignment group is currently empty.
On the flow in flow designer, click “Test” in the top right. It should open up a test popup window and ask what Incident you want to test against. I will select INC0018716 which is my test Incident I have been using. Click “Run Test”.
Once the test completes, you should see a message appear. If you wanted to check the execution you could click the “Your test has finished running. View the flow execution details” and it will redirect you to the test. I am going to check the Incident to see if it worked.
Success! We can see next to the “Category” field there is a blue activity icon indicating that it worked.
Now let’s reset the incident so we can test the trigger how we intended to work. Set the category back to “ – None –” and save. Go back to the flow in Flow Designer and click “Activate” in the top right corner.
You should not see any error messages, and the “Activate” button will be greyed out and “Deactivate” will appear. Our flow is now active, let’s go back to our test Incident and change the assignment group to “IT Support” and save it.
Success! The incident has been assigned to “IT Support” and the category has been updated. Feel free to test other incidents by assigning them to your “IT Support” group. If you do not get the categories that you are expecting, trying prompt engineering your skill. You may have to give context on what the categories mean and what type of tickets you should see in that category.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.