Can I register an event on a table from another scope?

tom_de_boer
Kilo Explorer

Hello Everyone,

I have a table #a in scope A.

Scope B is an application that is dependent on scope A.

In scope B runs a business rule on table #a.

In this business rule I would like to call an event.

If I try to register this event in scope B, but than I can not select the table #a because the event is in scope B and table in scope A.

This latter is also described on the wiki:

Event Registry - ServiceNow Wiki

event_wiki.PNG

What is the best workaround / Solution for this?

These are the workarounds I can think of:

  • I can register the event in scope A, but this also requires me to create the business-rule in scope A, because I cannot call an event from another scope.
    • I call the event like this while in scope B: gs.eventQueue('scope_a_name.event_name');
    • However I get the following message: Security restricted: Access to event 'scope_a_name.event_name' from scope 'scope_b_name' has been refused. The event defined in sysevent_register is in scope B.
  • I can thus better register both business rule and event in scope A and this is the workaround I currently use.

I would like to hear any opinions, best practices

Thanks and Kind regards,

Tom

1 REPLY 1

john_roberts
Mega Guru

It looks like you are correct on the approach. The caller (business rule) must be in either global or the same scope as the event registration. However, I did notice that the event listener (email notification or script action) can listen from a different event.



For example:


BR in scope A (or global) can fire Event in scope A, to trigger an email notification or script action in scope B.