- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-08-2017 01:19 PM
Hi,
Thanks in advance for looking at this issue. I've reviewed quite a few community posts andrew.och asimpkin here that are similar in nature, but not quite covering my use case and a problem I can't seem to solve.
I'm using Helsinki On-Call scheduling and am attempting to use the Notify and Assign workflow to check the rota, see if there is a an on-call person, and assign to that group and the primary person. I simply want this workflow to look at the rule and assign the correct group and primary on-call person defined in that schedule.
I have a rotation setup, trigger rules setup (e.g. when a P1 or P2 is assigned, assign to this group and primary person), but when the workflow gets to "Should the task be assigned?" run script activity, only the group is being assigned and the Assigned To with the Primary on-call person is not being assigned. How can I make this workflow assign the Incident to the correct group AND the Primary on-call person?
The script logs an error as below. There isn't even a line 51 in the script to try and troubleshoot further and I've searched elsewhere without luck.
Should the task be assigned?(74b18948dbd83200835dfcdfbf9619de): org.mozilla.javascript.WrappedException: Wrapped org.mozilla.javascript.JavaScriptException: java.lang.IllegalArgumentException: Argument must be a String or NativeString instance (<refname>; line 51)
Thanks and appreciate your help.
Solved! Go to Solution.
- Labels:
-
Incident Management
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-09-2017 09:28 AM
OK so I tested on my demo instance and there is definitely a bug in the out of the box workflow. I would suggest you raise an incident in Hi. Please feel free to reference this post in your incident. But to get you going the solution is a quick fix:
1. Open Workflow Editor and check out the On-Call: Assign and Notify workflow
2. Open the If "Should the task be assigned" activity
3. Edit lines 9 and 12 where there is a reference to the workflow.inputs.assignment_group variable. You just need to add toString() at the end of that. So your script should look like the following when done:
gs.include("OnCallRotation");
answer = ifScript();
function ifScript() {
//Get the assignment group from the input variable
//Assign the incident to the right on-call resource
var rota = new OnCallRotation();
rota.who(workflow.inputs.assignment_group.toString());
var currentOnCall = rota.getPrimaryUser();
workflow.scratchpad.assignment_group_id = workflow.inputs.assignment_group.toString();
workflow.scratchpad.current_on_call_id = currentOnCall;
//Only assign if there is someone is on_call & assigned_to is empty
if(currentOnCall && current.assigned_to.nil()) {
workflow.scratchpad.comments = gs.getMessage("Incident assigned based on current on-call resource");
return 'yes';
} else
return 'no';
}
4. Click Update.
5. Publish your workflow and test.
Please mark any post as helpful or the correct answer so others can benefit.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-09-2017 08:50 AM
Conor, trigger rules are basically assignment rules so that is what is assigning the group to your task. So basically what happens is the trigger rules execute and if a condition matches it will assign the task to the group defined and then launch the workflow set in the trigger rule. it sounds like you have everything there setup correctly since you are finding that your task is assigned to the right group.
Once the workflow starts, it is what is driving the escalation process. The out of the box On-Call: Assign and Notify workflow basically looks at the current task's assignment group and then checks the On-Call Rota to see who is on call and then assign the task to that person and then notify them. Have you verified via On-Call Calendars that someone is on-call for that particular group? Also make sure that the user has a defined SMS notification device setup as well since that is what On-Call leverages to send out the notification.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-09-2017 08:54 AM
Hi Michael,
Appreciate the response. The trigger rule for the group appears to be working, and is executing correctly. I have an on-call Rota, a person set as primary for this group in particular. They also have an E.164 number set as their mobile device. The problem is, the workflow doesn't even get to to the "Assign to current rota member" part of the workflow, or notify the person. My Incident is only ever assigned to the group and not the Primary individual, and the "Should this be assigned" part of the workflow is giving an error and therefore ending. The script ending at this part then obviously skips the "Assign to current rota member" and "notify" person.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-09-2017 09:28 AM
OK so I tested on my demo instance and there is definitely a bug in the out of the box workflow. I would suggest you raise an incident in Hi. Please feel free to reference this post in your incident. But to get you going the solution is a quick fix:
1. Open Workflow Editor and check out the On-Call: Assign and Notify workflow
2. Open the If "Should the task be assigned" activity
3. Edit lines 9 and 12 where there is a reference to the workflow.inputs.assignment_group variable. You just need to add toString() at the end of that. So your script should look like the following when done:
gs.include("OnCallRotation");
answer = ifScript();
function ifScript() {
//Get the assignment group from the input variable
//Assign the incident to the right on-call resource
var rota = new OnCallRotation();
rota.who(workflow.inputs.assignment_group.toString());
var currentOnCall = rota.getPrimaryUser();
workflow.scratchpad.assignment_group_id = workflow.inputs.assignment_group.toString();
workflow.scratchpad.current_on_call_id = currentOnCall;
//Only assign if there is someone is on_call & assigned_to is empty
if(currentOnCall && current.assigned_to.nil()) {
workflow.scratchpad.comments = gs.getMessage("Incident assigned based on current on-call resource");
return 'yes';
} else
return 'no';
}
4. Click Update.
5. Publish your workflow and test.
Please mark any post as helpful or the correct answer so others can benefit.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-09-2017 10:06 AM
Michael,
Many thanks on your response. That did the trick to convert lines 9 and 12 to include the toString() function at the end. I will open a HI ticket so ServiceNow can review.
To your point about the Send SMS part of the workflow leveraging a defined SMS device - Is this in addition to configuring a user's mobile phone phone record on the user table?