org.mozilla.javascript.EcmaError: Method "ScopedGlideRecord" called on incompatible object.

aklimenko
Mega Expert

In business rule. Check application access for sc_req_item - all on except for delete. This is a second case like that...

org.mozilla.javascript.EcmaError: Method "ScopedGlideRecord" called on incompatible object.

Caused by error in Business Rule:

1: function onAfter(current, previous) {

2:

3: var request = null;

==> 4: var gr = GlideRecord('sc_req_item');

5: gr.addQuery('correlation_id', current.activty_id);

6: gr.addQuery('state', 1);

7: gr.query();

9 REPLIES 9

Hi Alexey,



So from your scope you are querying the system table(sc_req_item) which is in global scope. So in this case rules are limited.   Can you please try once using "when is before" in BR and let me know the outcome.


Same error for both before and async


aklimenko
Mega Expert

Was missing new before GlideRecord


Pefect


Would you mind marking my answer as correct/helpful if this resolves your issue.


Community Alums
Not applicable

4 Years on and still relevant (I was looking straight through this exact same typo in my own code) . . . thank you sooo much