Skip to page contentSkip to chat
ServiceNow support
    • Community
      Ask questions, give advice, and connect with fellow ServiceNow professionals.
      Developer
      Build, test, and deploy applications
      Documentation
      Find detailed information about ServiceNow products, apps, features, and releases.
      Impact
      Accelerate ROI and amplify your expertise.
      Learning
      Build skills with instructor-led and online training.
      Partner
      Grow your business with promotions, news, and marketing tools
      ServiceNow
      Learn about ServiceNow products & solutions.
      Store
      Download certified apps and integrations that complement ServiceNow.
      Support
      Manage your instances, access self-help, and get technical support.
Executing an action that triggers the On-Call Assign workflow produces an error in the logs - Support and Troubleshooting
  • >
  • Knowledge Base
  • >
  • Support and Troubleshooting (Knowledge Base)
  • >
  • Executing an action that triggers the On-Call Assign workflow produces an error in the logs
KB0659188

Executing an action that triggers the On-Call Assign workflow produces an error in the logs


1614 Views Last updated : Jun 24, 2025 public Copy Permalink
KB Summary by Now Assist

Issue

Executing an action triggering the On-Call Assign workflow produces the following error in the logs:

Is there any schedule at the time?(be827be2db7103001d80d001cf961926): org.mozilla.javascript.WrappedException: Wrapped ReferenceError: "vars" is not defined. (answer = ifScript();
 
function ifScript() {
var rota = new SNC.OnCallRotation();
var gdt = new GlideDateTime();
var escalationPlan = rota.getEscalationPlan(vars.assignment_group.sys_id.toString(), gdt);
 
if (JSUtil.nil(rota) || JSUtil.nil(rota.getCurrentRotaID())) {
return 'no';
}
return 'yes';
}
; line 6) (<refname>; line 51)
 

Cause

The On-Call: Assign workflow is designed to be triggered by creating a New Call of type Incident, and clicking Submit. The system then searches the Trigger Rules table and starts the workflow based on conditions.

When you create an Incident directly from the Incidents module, you cannot use the On-Call: Assign workflow. Instead, you need to create a workflow that runs when your condition is matched. 

The Process Trigger Rule Script action is in charge of setting the value of

var vars = {};

                vars.assignment_group = rule.group;

if this is not set, then the workflow fails when running the line:

var escalationPlan = rota.getEscalationPlan(vars.assignment_group.sys_id.toString(), gdt);

The event kicks off only when creating a new incident through the new_call record, which kicks off automatically if the New Call record is of type Incident.

 

Resolution

Navigate to the Process Trigger Rule script action:

https://<instance>/nav_to.do?uri=sysevent_script_action.do?sys_id=2d7a7000eb301100fcfb858ad106fe42

Use guard code  such that the workflow could be triggered as intended (via trigger rules), with vars passed to workflow and change the var escalationPlan = rota.getEscalationPlan(vars.assignment_group.sys_id.toString(), gdt); so it acquires the assignment_group directly from the incident after the trigger rule has made the assignment:

var assignmentGroupSysId = ""
if (typeof vars !== "undefined" && vars && vars.assignment_group) else     assignmentGroupSysId = current.assignment_group.sys_id.toString(); var escalationPlan = rota.getEscalationPlan(assignmentGroupSysId, gdt);  

 


The world works with ServiceNow.

Sign in for more! There's more content available only to authenticated users Sign in for more!
Did this KB article help you?
Did this KB article help you?

How would you rate your Now Support digital experience?

*

Very unsatisfied

Unsatisfied

Neutral

Satisfied

Very satisfied

Very unsatisfied

Unsatisfied

Neutral

Satisfied

Very satisfied

What can we improve? Please select all that apply.

What are we doing well? Please select all that apply.

Tell us more

*

Do you expect a response from this feedback?

  • Terms and conditions
  • Privacy statement
  • GDPR
  • Cookie policy
  • © 2025 ServiceNow. All rights reserved.