Triggering Scheduled discovery

subin ps1
Tera Contributor

HI ,

 

I'm trying to trigger a scheduled discovery from script , but its not working as expected.

 

var rec = new GlideRecord('sysauto_script');

rec.addEncodedQuery('name','name=Cloud Service Account - ******');
rec.query();

SncTriggerSynchronizer.executeNow(rec);

 

the above script is not triggering from background script. 

 

Thanks in advance,

Subin

2 REPLIES 2

Niklas Peterson
Mega Sage
Mega Sage

Hi,

Your encoded query looks weird. Double check it.

 

Or you can run it like this

 

var rec = new GlideRecord('sysauto_script');
rec.get('name', 'YOUR_JOB_NAME_HERE');
SncTriggerSynchronizer.executeNow(rec);

Regards,
Niklas

Lilypugh
Mega Contributor

Hii,

 

You can ensure that the GlideRecord query is correctly formatted, for example: rec.addQuery('name', 'Cloud Service Account - ******'); Also, check if the GlideRecord query actually returns the desired record and if the SncTriggerSynchronizer execution fits within your script's context.

Best regard,
YourTexasBenefits