Triggering a script action from an event

Ram117
Kilo Sage

Experts,

I have a scoped application OnDemand syauto_script creating a custom event. This scheduled event (gs.eventScheduled : code below) is basically creating a script which kicks a script action

gs.eventQueueScheduled('x_abc_scope.trigger_next_sch', scheduleGr, "trigger_next_job", scheduleGr.getUniqueValue(), gdt);

The script action contains a script which needs to trigger a schedule script execution (sysauto_Script).

When the scheduled event runs, I am not able to see the script action 'script' not getting executed. Below is the script within the script action. The script action is created on the scoped app.

// here parm2 is coming from the event
try {
    gs.info('Trigger next schedule job starting <--');
    var schedGr = new GlideRecord("sysauto_script");
    if (schedGr.get(event.parm2)) {
        gs.executeNow(schedGr);
        gs.info("Triggered for sysauto_script");
    }
} 
catch (ex) {

  throw new Error('Unable to find sysauto_script with sys_id  passed from event '+ex.message);

}

 

sysevent created 

find_real_file.png

 

Thx

ram.

 

1 ACCEPTED SOLUTION

Ram117
Kilo Sage

Closing the thread.

The issue was with my event condition check. As I said, the issue was something silly and now its all working fine.

View solution in original post

14 REPLIES 14

sachin_namjoshi
Kilo Patron
Kilo Patron

Are you getting any errors in system logs when this script action executes?

Also, it may be cross-scope, RCA access issue between sysauto_script and your custom scope.

Create required cross-scope, RCA records and check if it resolves your issue.

 

Regards,

Sachin

Thank you for the response Sachin.

I do not see any cross scope access privilege errors on the logs..

I am also able to execute the script from a global scope .

Infact, this was working and the only change which I did was creating a dedicated event processor for processing the next set of events which gets created by the 'scheduled job' which this script is suppose to create.

Cross scope record already exists from global.

find_real_file.png