- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-21-2016 05:31 AM
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
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-21-2016 05:52 AM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-21-2016 06:24 AM
Or may be try {} catch {} would work better

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-21-2016 06:24 AM
That should work. Some alternatives...
if (RP) {
RP.getParameterValue('sysparm_query');
}
Or you could use a try/catch

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-21-2016 06:30 AM
If I have answered your question, please mark my response as correct so that others with the same question in the future can find it quickly and that it gets removed from the Unanswered list.
If you are viewing this from the community inbox you will not see the correct answer button. If so, please review How to Mark Answers Correct From Inbox View.
Thank you