Access a global table from a scoped application in an Event.

robert_jrp
Giga Contributor

Hello developers community.

To give you some context: We have a solution that involves a number of customizations on the native Service Catalog Requests process, and we were doing those customizations in the global scope. However, in order to be able to deploy our solution to the ServiceNow Store, we found out that we had to create a scoped application. The customizations involve events, script includes, business rules, script actions, outbound REST messages, among others. We do not use any custom tables or forms. We are able to create everything inside the scope of the new application, but the events, since these events have to happen when there are changes on a global table (sc_request). So, we are forced to create the event as global, however, how can we deploy our entire solution as an application, if the events will not be included? Is there a way to include it? What's the best practice in this case?

Thanks for your support.

Regards.

11 REPLIES 11

Hello Roberto,



finally i came up with the solution :



  • if you're creating an event in your private scope and this is possible only when your table is in your scope. because events will fire in scope level only.
  • Table   shows The database table for this event. Note: The list shows only tables and database views that are in the same scope as the event.


Thanks,
Rajashekhar Mushke
Rising star : 2022 - 2024
Community Leader -2018
Connect me on LinkedIn : Rajashekhar Mushke

Hi Roberto,




Please close this thread. or else let me know if you need more help.



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.





Thanks,
Rajashekhar Mushke
Rising star : 2022 - 2024
Community Leader -2018
Connect me on LinkedIn : Rajashekhar Mushke

Thanks Rajesh,



Your reply is very helpful, however does not answer my original question: If my solution includes these global events, how will I be able to deploy the entire solution as an application for the customers to download in the store? I generated an update set, however it only included everything I added within the scope of the new application, not in the global scope aswell.



Thanks and regards.


Hello Roberto Rodrí­guez,



This cloud be help full,



  • you can register the event in scope A, but this also requires me to create the business-rule in scope A, because you cannot call an event from another scope
    • call the event like this while in scope B: gs.eventQueue('scope_a_name.event_name');
    • However you 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.
  • you can thus better register both business rule and event in scope A.


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.




.




Thanks,
Rajashekhar Mushke
Rising star : 2022 - 2024
Community Leader -2018
Connect me on LinkedIn : Rajashekhar Mushke

Hello rajeshmushke,



That is exactly what I am doing: I have two scopes:


  • Global scope: Event and business rule
  • Application scope: All other things (scripts, REST messages, script includes).


Now the question is, how can I deploy both scopes as a single solution to the store?



Thanks and regards.