Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

RP is not defined

Andrii
Kilo Guru

Hi,

I am getting this error:

org.mozilla.javascript.EcmaError: "RP" is not defined.

Caused by error in Business Rule: 'My_Incident_Business_Rule' at line 9

6: inc.addQuery('state','!=',1);

7: inc.addQuery('parent',current.parent);

8: inc.addNotNullQuery('parent');

==> 9: inc.query();

10:

11: // initial value

12: var wtd = 0.0;

and I wonder why RP is not defined? Any ideas?

Seems that I have 2 Business Rules on Incident [ incident ] Table that have some conflict:

1) Before Query Business Rule that leverages RP: "

RP.getParameterValue('sysparm_query');

"

2) After Business Rule

1 ACCEPTED SOLUTION

Chuck Tomasi
Tera Patron

When ever the first script does a query, it uses the before/query business rules to do any filtering. It's the same if you present a list to a user. So the inc.query() is triggering the before business rule which cannot find RP. This is not a standard OOB BR. Do you know who wrote it and what it's purpose is? If not, I recommend disabling it as a test to ensure the other BR works fine.


View solution in original post

7 REPLIES 7

Chuck Tomasi
Tera Patron

When ever the first script does a query, it uses the before/query business rules to do any filtering. It's the same if you present a list to a user. So the inc.query() is triggering the before business rule which cannot find RP. This is not a standard OOB BR. Do you know who wrote it and what it's purpose is? If not, I recommend disabling it as a test to ensure the other BR works fine.


I do understand that inc.query() triggers Before Query Business Rules - the question is - RP is not defined because rule triggered not from UI ?


That's correct.


So If I add condition into another Business Rule, something like:


if (RP != 'undefined') { ... }



that should work I guess