Servicenow Script Action not executed

Anubhuti Mittal
Tera Contributor

Hi Team , 

 

I am working in a scoped application . I have to trigger a script that runs in background when a business rule is fired. For this i have created an event and a script action .

The event is fired from a before update business rule.

The event goes into the processed state but the associated script action is never triggered.

 

Business rule code 

gs.eventQueue('sn_vul.<BR NAME>',current, 'XX','YY');
 
 
6 REPLIES 6

Ankur Bawiskar
Tera Patron
Tera Patron

@Anubhuti Mittal 

business rule, event, script action all should in your scope app

Did you link your script action with the event you created? 

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Yes, everything is in same scope and the event is linked to the script action.

@Anubhuti Mittal 

share some screenshots.

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Community Alums
Not applicable

hi @Anubhuti Mittal ,

When you’re in a scoped application, events work a bit differently compared to global scope. If your Business Rule is in scope sn_vul, your Script Action must also be in the same scope (or at least be accessible from it). Make sure:

  • Your Script Action is created inside your scoped app (sn_vul) and not under global.

  • The event name you used to fire the event (sn_vul.<BR NAME>) exactly matches the event name you defined in the Event Registry (no typos, extra spaces, or case differences).

  • In the Script Action, double-check that it’s set as Active and the condition is correct (or empty if you want it to always run).

Another important point: since you’re firing the event from a before Business Rule, sometimes the event context isn’t fully ready (for example, if you rely on current field values after update).

  • Try moving the gs.eventQueue() to an after Business Rule instead, so the event is fired after the update happens.

  • Or if it must stay in the before rule, confirm that the fields you need are already set on current at that point.


Quick checklist:
Script Action is in the same scope (sn_vul).
Event name in Business Rule and Event Registry is identical.
Script Action is active.
Condition on Script Action isn’t filtering it out.
Test firing the event manually in the background script to see if the Script Action is triggered.