org.mozilla.javascript.EcmaError: Method "ScopedGlideRecord" called on incompatible object.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-13-2015 01:00 PM
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();

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-13-2015 09:22 PM
The types of business rules you can create and how you can access those rules varies depending on the scope of the business rule and the scope of the table it runs on.
Please check the section 3 for more info on this.
Business Rules - ServiceNow Wiki
I hope this helps
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-13-2015 10:05 PM
It does, thank you.
However in my case the rule is on my scope custom table, it is only that GlideRecord is done on global table.
Can't I query tables out of scope there?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-13-2015 10:28 PM
Hi Alexey,
For tables that are in a different scope than the business rule record, the types of rules are limited.
- You can create a rule where When is async with any of the following options:
- Insert, Update, and Delete database operations. You cannot select Query.
- Set field values actions and scripts (the Script field).
- You can create a rule where When is before with any of the following options:
- Insert, Update, and Delete database operations. You cannot select Query.
- Set field values actions only. You cannot write scripts and you cannot abort the database transaction.
- You cannot create any other types of business rules on tables in a different scope.
Please let me know if you have any questions.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-13-2015 10:46 PM
I read it. But my rule is on my custom table in my scope, not external scope. I am just trying to read the value of some other table in script. The paragraph you posted doesn't say you can't query DB inside scripts. If it was the case then the limitation would be very strange to me.