Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Get instance of GlideScriptedHierarchicalWorker via progressID

ducdhm
Giga Contributor

Hi guys,

Do you know how to get instance/record of GlideScriptedHierarchicalWorker by using progressID?

Example: I have a code for Worker like:

var worker = new GlideScriptedHierarchicalWorker();

worker.setProgressName('Import Services');

worker.setBackground(true);

worker.setScriptIncludeName('x_ausgh_snsc.SaraConsumerWorker');

worker.setScriptIncludeMethod('run');

worker.putMethodArg('targetCatId', targetCatId);

worker.start();

var progressID = worker.getProgressID();

I want to get worker in other code via progressID. So how can?

5 REPLIES 5

	cancel: function() {
		var trackerId = this.getParameter("sysparm_tracker_id");
		if (!trackerId)
			return false;

		var execTracker = new SNC.GlideExecutionTracker(trackerId);
		execTracker.cancel(gs.getMessage("Conflict detection has been cancelled"));
	}

From Script include ChangeConflictAJAXProcessor()