ERROR Test failed: Can't find method com.snc.automation.TriggerSynchronizer.executeNow(string).

Ron28
Mega Sage

I just ran into this error while creating an ATF test to start a Discovery schedule.

When putting the following code in a background script, this works fine:

var schedule = 'fcc83251db4829185c863ec3f39619b6';

var grSched = new GlideRecord('discovery_schedule');		// Need to pass reference to Discovery script include
grSched.get(schedule);								        // Get Schedule record

var d = new Discovery();
var sta = d.discoverNow(grSched);

var grStatus = new GlideRecord('discovery_status');
grStatus.get(sta);

gs.print('Discovery Status Record number: ' + grStatus.getValue('number'));

// Output:
//*** Script: Discovery Status Record number: DIS4073844

 

But when running this near enough identical code via an ATF test in a scripted step I get the above error on the call to the Discovery script include, discoverNow() method:

(function executeStep(inputs, outputs, stepResult, timeout) {
	var schedule = 'fcc83251db4829185c863ec3f39619b6';
	var grSched = new GlideRecord('discovery_schedule');

	var d = new Discovery();
	var status = d.discoverNow(schedule); 				// Returns sys_id of Discovery Status record


I've hardcoded the sys_id of the schedule here only to have an identical call to the Discovery script include. 
The error:

ERROR Test failed: Can't find method com.snc.automation.TriggerSynchronizer.executeNow(string). (sys_script_include.a6cdaf5bc0a802550004f460b6c04967.script; line 46)
	org.mozilla.javascript.DefaultErrorReporter.runtimeError(DefaultErrorReporter.java:58)
	org.mozilla.javascript.Context.reportRuntimeError(Context.java:1570)


Thinking this was a scope issue I checked all components:

test 
re-usable test
scripted step
script include

are all in the Global app scope. The script include is unmodified, OOB. 

Any ideas what is going wrong?

 

Thanks
Ron

 

 

3 REPLIES 3

Tanushree Maiti
Tera Sage

Hi @Ron28 

 

Make sure you have role  discovery_adminor admin .

 

Also you can refer: 

 

https://www.servicenow.com/community/developer-forum/snctriggersynchronizer-executenow-is-not-workin...

 

 

Please mark this response as Helpful & Accept it as solution if it assisted you with your question.
Regards
Tanushree Maiti
ServiceNow Technical Architect
Linkedin:

Ron28
Mega Sage

I do have both discovery_admin and admin roles.

In the re-usable test I added a step to impersonate myself, to be sure whatever user runs the test has the roles. The impersonation step is successful but it does not resolve the issue.

What scenario does your test actually cover? The SncTriggerSynchronizer (used to start the background job) class is not available and I doubt you can get it to be. You could try a ui step that clicks the Discover now ui action on the schedule form and see if that works but I don't really understand what the test is for