Notifications

70 views

Description

When creating a business rule, it is common to specify a filter condition to specify when that business rule will run. 

If one of the filter conditions is on a field that is a System Class Name field (eg., Task type or Class), and the "is a" (aka INSTANCEOF) test operator is used, but the test value is left as "-- None --", then you will get the following error during evaluation of the filter condition:

Table name cannot be null: java.lang.IllegalStateException: Table name cannot be null: com.glide.db.TableDescriptor.<init>(TableDescriptor.java:81)
com.glide.db.TableDescriptor.get(TableDescriptor.java:86)
com.glide.db.conditions.InstanceOfCondition.shouldOptimizeWithClassPathQuery(InstanceOfCondition.java:83)
com.glide.db.conditions.InstanceOfCondition.setValue(InstanceOfCondition.java:54)
com.glide.db.conditions.QueryCondition.create(QueryCondition.java:278)
com.glide.db.conditions.QueryCondition.create(QueryCondition.java:241)
com.glide.db.QueryString.buildCondition(QueryString.java:713)
com.glide.db.QueryString.processCurrentTerm(QueryString.java:617)
com.glide.db.QueryString.buildConditions(QueryString.java:554)
com.glide.db.QueryString.deserialize(QueryString.java:327)
com.glide.db.QueryString.deserialize(QueryString.java:313)
com.glide.db.DBQuery.addQueryString(DBQuery.java:477)
com.glide.db.DBQuery.addQueryString(DBQuery.java:457)
com.glide.db.DBQuery.addQueryString(DBQuery.java:444)
com.glide.script.QueryStringScriptGenerator.initConditionListFromQueryString(QueryStringScriptGenerator.java:78)
com.glide.script.QueryStringScriptGenerator.generate(QueryStringScriptGenerator.java:67)
com.glide.script.Filter.getScript(Filter.java:133)
com.glide.script.Filter.getScript(Filter.java:124)
com.glide.script.Filter.match(Filter.java:95)
com.glide.script.Filter.match(Filter.java:85)
com.glide.script.Filter.checkRecord(Filter.java:211)
com.glide.script.Filter.checkRecord(Filter.java:194)
com.glide.script.BusinessRule.checkFilterCondition(BusinessRule.java:480)
com.glide.script.BusinessRule.conditionMet(BusinessRule.java:448)
com.glide.script.BusinessRule.runBusinessRule(BusinessRule.java:191)
com.glide.script.BusinessRule.run(BusinessRule.java:180)
com.glide.script.GlideRecordBusinessRules.run(GlideRecordBusinessRules.java:95)
com.glide.script.GlideRecord.runScripts(GlideRecord.java:1377)
com.glide.script.GlideRecord.runScriptsAndEngines(GlideRecord.java:1311)
com.glide.script.GlideRecord.updateWithoutResettingOperation(GlideRecord.java:4530)
com.glide.script.GlideRecord.update(GlideRecord.java:4458)
com.glide.script.GlideRecord.update(GlideRecord.java:4377)
com.glide.script.GlideRecord.updateNewClass(GlideRecord.java:5208)
com.glide.script.GlideRecord.updateWithoutResettingOperation(GlideRecord.java:4507)
com.glide.script.GlideRecord.update(GlideRecord.java:4458)
com.glide.script.GlideRecord.jsFunction_update(GlideRecord.java:4250)
sun.reflect.GeneratedMethodAccessor385.invoke(Unknown Source)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
java.lang.reflect.Method.invoke(Method.java:498)
org.mozilla.javascript.MemberBox.invoke(MemberBox.java:138)
org.mozilla.javascript.FunctionObject.doInvoke(FunctionObject.java:670)
org.mozilla.javascript.FunctionObject.call(FunctionObject.java:614)
org.mozilla.javascript.ScriptRuntime.doCall(ScriptRuntime.java:2582)
org.mozilla.javascript.optimizer.OptRuntime.callProp0(OptRuntime.java:85)
org.mozilla.javascript.gen.null_null_script_3919._c_script_0(null.null.script:6)
org.mozilla.javascript.gen.null_null_script_3919.call(null.null.script)
org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:563)
org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3429)
org.mozilla.javascript.gen.null_null_script_3919.call(null.null.script)
org.mozilla.javascript.gen.null_null_script_3919.exec(null.null.script)
com.glide.script.ScriptEvaluator.execute(ScriptEvaluator.java:279)
com.glide.script.ScriptEvaluator.evaluateString(ScriptEvaluator.java:118)
com.glide.script.ScriptEvaluator.evaluateString(ScriptEvaluator.java:82)
com.glide.script.fencing.GlideScopedEvaluator.evaluateScript(GlideScopedEvaluator.java:309)
com.glide.script.fencing.GlideScopedEvaluator.evaluateScript(GlideScopedEvaluator.java:214)
com.glide.script.fencing.GlideScopedEvaluator.evaluateScript(GlideScopedEvaluator.java:201)
com.glide.processors.ScriptProcessor.evaluateScript0(ScriptProcessor.java:383)
com.glide.processors.ScriptProcessor.lambda$evaluateScriptWithRecordingOption$0(ScriptProcessor.java:377)
com.glide.rollback.recording.RollbackRecorder.execute(RollbackRecorder.java:67)
com.glide.processors.ScriptProcessor.evaluateScriptWithRecordingOption(ScriptProcessor.java:377)
com.glide.processors.ScriptProcessor.evaluateScript(ScriptProcessor.java:357)
com.glide.processors.ScriptProcessor.runScript(ScriptProcessor.java:246)
com.glide.processors.ScriptProcessor.process(ScriptProcessor.java:204)
com.glide.processors.AProcessor.runProcessor(AProcessor.java:553)
com.glide.processors.AProcessor.processTransaction(AProcessor.java:240)
com.glide.processors.ProcessorRegistry.process0(ProcessorRegistry.java:177)
com.glide.processors.ProcessorRegistry.process(ProcessorRegistry.java:166)
com.glide.ui.GlideServletTransaction.process(GlideServletTransaction.java:31)
com.glide.sys.Transaction.run(Transaction.java:2192)
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
java.lang.Thread.run(Thread.java:748)

Steps to Reproduce

1) Hop into SNC Instance - demonightlynewyork
2) Navigate to the System Definition > Business Rules module.
3) CLick on the "New" button.
4) Enter the following information:

Name: Generate IllegalStateException
Table: Task [task]
Advanced: True
When to run > When: before
When to run > Update: true
When to run > Filter Conditions: Task type is a -- None --

5) Click on the "Submit" button.
6) Navigate to the System Definition > Scripts - Background module.
7) Enter the following information:

Run script:

var gr = new GlideRecord('task');
gr.setLimit(1);
gr.query();
if (gr.next()) {
gr.work_notes = 'Generate IllegalStateException';
gr.update();
}

Click on the "Run Script" button.

Note: This problem also applies to other scripts using filters in a similar way, such as the scheduled job "CMDB Health Dashboard - Relationship Compliance Processor".

Workaround

This problem 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.

The workaround to this issue is to make sure you have no INSTANCEOF filter conditions with "-- None --".


Related Problem: PRB1382043

Seen In

SR - ITOM - Discovery and Service Mapping - 201908

Fixed In

Paris

Associated Community Threads

There is no data to report.

Article Information

Last Updated:2020-08-04 08:21:32
Published:2020-07-30