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.
global.WorkflowApprovalUtils().reset Does Not Validate Parameters - Support and Troubleshooting
  • >
  • Knowledge Base
  • >
  • Known Error (Knowledge Base)
  • >
  • global.WorkflowApprovalUtils().reset Does Not Validate Parameters
KB1437909

global.WorkflowApprovalUtils().reset Does Not Validate Parameters


477 Views Last updated : Feb 26, 2024 public Copy Permalink
KB Summary by Now Assist

Description

The reset() method in WorkflowApprovalUtils will delete sysapproval_approver records related to the "task" parameter that is passed into it. However, that parameter is not validated and if it is not a valid GlideRecord the delete query that ends up being generated can match all sysapproval_approver records with an empty sysapproval field. This results in unwanted deletion of those records.

Steps to Reproduce

1. Ensure that sysapproval_approver table contains at least 1 record with an empty sysapproval field
2. from Scripts-Background, run "new WorkflowApprovalUtils().reset({sys_id : ""});"
 Expected: the sysapproval_approver records will not be deleted
 Actual: they are deleted

Other "invalid" parameters that can be passed into reset and may cause this issue depending on the JS engine mode used by the script execution are:
reset(null)
reset("")
reset()
reset(anyObjectWithoutASysIdProperty)
reset(new GlideRecord("task"))

Workaround

The workaround is to add the following code to the beginning of the WorkflowApprovalUtils reset() method:

 
reset: function(/*GlideRecord*/ task, /*optional*/ comment) {
  //guard against an invalid task record
  if (JSUtil.nil(task) || JSUtil.nil(task.sys_id)) {
      gs.warn("Approval reset skipped because the task is invalid");
      return;
  }
...rest of the existing method code continues here

 




Related Problem: PRB1682045

Potentially Seen In

There is no data to report.

Fixed In

Tokyo Patch 10
Utah Patch 6
Vancouver Patch 1
Washington DC

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.