Notifications

116 views

Description

The base system Business Rules from the 'Certification Core' plugin [ com.snc.certification_core ], named "Update next run time" [ sys_id = d085db81df20010068c37a0d3df26334 ] and "Update next run time during execution" [ sys_id = 5d4d7ed1dfa0010068c37a0d3df26362 ] cause recursion every time they are executed.

With many records in the [audit_cert] table, this impacts performance.

Steps to Reproduce

  1. Open the list view for the [cert_audit] table.
  2. Edit any of the record's data, for example, change the 'Run' value and save/update the record.
  3. Check the current node's localhost log and you will see that the execution of the Business Rule causes a recursion and it's stopped:
    2019-01-25 03:34:30 (901) Default-thread-2 EBC52D50DB5FEB00E7DB1C04399619F5 txid=b0aabd54db9f Recursive business rule call for 'Update next run time' on cert_audit:Server Minimum Statistics is being ignored. Business Rule Stack: Update next run time,Update next run time

Actual Behavior: Recursion occurs every time the Business Rules are executed.

Expected Behavior: There should be no recursion.

Workaround

This issue has been fixed. If you are able to upgrade, review the Fixed In or Intended Fix Version fields to determine whether any versions have a planned or permanent fix.

If you are unable to upgrade, you may try to apply the following workaround.

Preparation: Create an update set so that the changes are enclosed and can be promoted to upper instances.

  1. Change the "When to run" from After to Before for the following Business Rules:
    • "Update next run time"
    • "Update next run time during execution"
  2. Change the script of the Business Rules as follows:
    • Business rule: "Update next run time":
      updateNextRunTime();
      
      function updateNextRunTime() {
      var gr = new GlideRecord("cert_audit");
      
      if(gr.get(current.sys_id)) {
      if (gr.run_type != "on_demand")
      gr.next_scheduled_run = (new CertificationUtils()).getTriggerNextRunTime(false, "cert_audit", gr.sys_id);
      else
      gr.next_scheduled_run = "";
      }
      }
      
    • Business rule: "Update next run time during execution"
      updateNextRunTimeDuringExecution();
      
      function updateNextRunTimeDuringExecution() {
      var gr = new GlideRecord("cert_audit");
      gr.get(current.sys_id);
      if (gr.run_type != "on_demand")
      gr.next_scheduled_run = (new CertificationUtils()).getTriggerNextRunTime(true, "cert_audit", gr.sys_id);
      else
      gr.next_scheduled_run = "";
      }
      

 

Note there will be a slight difference between the current code and the workaround code, therefore we strongly advise customers to test this in a lower environment (sub-production), before applying any changes to production. In case there are questions or concerns customers can create a new incident or contact ServiceNow Customer Support directly.


Related Problem: PRB1323923

Seen In

There is no data to report.

Fixed In

New York

Associated Community Threads

There is no data to report.

Article Information

Last Updated:2019-05-21 11:41:39
Published:2019-03-06