- 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-12-2017 09:47 AM
The scripting API I am referring to is this:
You definitely don't need to use REST to send it. A business rule can easily accomplish what you are wanting to do. You may also find an platform application I created and published to Share useful:
https://community.servicenow.com/community/develop/blog/2016/09/19/crisis-alert-management
It is a utility application that can mass notify users and groups. It is a scoped application so you can easily download and load into your development instance but it will require platform runtime licenses if you load it into production. You can speak to your sales rep about that pricing. There is a utility script include that has many code examples on sending SMS messages as well as text to speech calls.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-12-2017 01:31 PM
I loaded this into my personal dev instance. This is a phenomenal piece of engineering. I will have to do some additional investigation around its uses and potentials. Appreciate all your help, your original solution will be marked as correct.