JobsManager

Class

Perform operations on Workflow Manager jobs.

Create and delete jobs, manage properties of a job, search for jobs and monitor the status of work using job statistics, manage job attachments, holds, dependencies and comments, and perform work on jobs.

Refer to ManagerFactory.getManager to get a reference to this class.

Inheritance: JobsManagerBaseManager

Methods

MethodReturnsNotes

Add a file attachment to a job.

Add a linked attachment to a job.

Add a dependency for one or more steps on a job.

addHolds(params)

Add a hold for one or more steps on a job.

addJobComment(jobId, comment)
Promise<string>

Add a comment to a job.

assignCurrentStep(jobId, assignedTo, assignedType)
Promise<boolean>

Assign the current step of a job.

assignStep(jobId, stepId, assignedTo, assignedType)
Promise<boolean>

Assign one of the current steps on a job.

Promise<JobStatistics>

Calculate job statistics (counts).

closeJobs(jobIds)
Promise<boolean>

Close jobs in the Workflow Manager system.

createJobs(jobTemplateId, jobOverrides?)

Creates one or more jobs in the Workflow Manager system.

deleteAttachment(jobId, attachmentId)
Promise<boolean>

Delete an attachment from a job.

deleteJobs(jobIds)
Promise<boolean>

Delete jobs in the Workflow Manager system.

finishSteps(jobId, stepIds)

Finish running one or more steps on a job.

getAttachmentBody(jobId, attachmentId)
Promise<Blob>

Get a file attachment body.

getAttachmentUrl(jobId, attachmentId, includeToken)
Promise<string>

Get the url to a job attachment.

Promise<JobAttachment[]>

Get the list of attachments for a job.

getJob(jobId, options?)
Promise<Job>

Get the details of a job by jobId in the Workflow Manager system.

Promise<JobComment[]>

Get the comments for a job.

Get the diagram details for a job.

Promise<JobHistory[]>

Get the history details for a job.

Promise<Geometry>

Get the location for the job. Job locations are returned using the WGS 1984 Web Mercator (Auxiliary Sphere) coordinate system (spatial reference 3857). Supported geometry types are Multipoint , Polyline and Polygon .

queryJobs(query)
Promise<QueryResult>

Query jobs in the Workflow Manager system.

refreshSteps(jobId, stepIds)

Sends a refresh message to the step to resume the checking of a geoprocessing service if it stopped.

Release a dependency for one or more steps on a job.

releaseHolds(params)

Release a hold for one or more steps on a job.

reopenJobs(jobIds)
Promise<boolean>

Reopen closed jobs in the Workflow Manager system.

setCurrentStep(jobId, stepId)

Set a step as the current step on a job.

setJobLocation(jobId, geometry)
Promise<boolean>

Set a location of work for an existing job. Supported geometry types are Point , Multipoint , Polyline and Polygon .

startSteps(jobId, stepIds)

Starts one or more steps on a job.

stopSteps(jobId, stepIds)

Stop one or more steps on a job.

Promise<boolean>

Update an attachment on a job.

updateJob(jobId, jobUpdates)
Promise<boolean>

Update a job in the Workflow Manager system.

upgradeJobs(jobIds)
Promise<boolean>

Upgrade jobs with the latest diagram version.

addAttachment

Class Method
addAttachment(paramsJobAttachmentDetails): Promise<AddJobAttachmentResponse>

Add a file attachment to a job.

Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
9
10
11
// Provide details for the file attachment to add to the job
const attachmentDetails: JobAttachmentDetails = {
  jobId: 'job3',
  attachment: file, // File uploaded from a file upload form
  alias: 'Location 1 Photo',
  folder: 'images'
};
// Add the attachment
const results: AddJobAttachmentResponse = await jobsManager.addAttachment(attachmentDetails);
const attachmentId = results.attachmentId;
const attachmentUrl = results.url; // Url to access the attachment
Parameters
ParameterTypeNotes
params
JobAttachmentDetails

The attachment information to add to the job.

Returns 
Promise<AddJobAttachmentResponse>

Basic information on the added attachment.

addAttachmentLinked

Class Method
addAttachmentLinked(paramsJobAttachmentDetails): Promise<AddJobAttachmentResponse>

Add a linked attachment to a job.

Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
9
10
// Provide details for the linked attachment to add to the job
const attachmentDetails: JobAttachmentDetails = {
 jobId: 'job3',
 url: 'https://domain.hostname.com/doc',
 alias: 'Documentation Link',
 folder: 'info'
};
// Add the attachment
const results: AddJobAttachmentResponse = await jobsManager.addAttachmentLinked(attachmentDetails);
const attachmentId = results.attachmentId;
Parameters
ParameterTypeNotes
params
JobAttachmentDetails

The attachment details to associate to the job.

Returns 
Promise<AddJobAttachmentResponse>

Basic information on the added attachment.

addDependency

Class Method
addDependency(paramsJobDependencyDetails): Promise<JobActionResponse>

Add a dependency for one or more steps on a job.

Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
9
10
11
12
13
// Add a dependency to a step on a job.
// Step step5a on job3 cannot be run until job8 step11 has completed.
const dependencyDetails: JobDependencyDetails = {
 jobId: 'job3',
 stepIds: ['step5a'],
 dependentJobId: 'job8',
 dependentStepId: 'step11'
};
const result: JobActionResponse = await jobsManager.addDependency(dependencyDetails);
const stepResponses = result.stepResponses;
stepResponses.forEach(response => {
 console.log(`Step ${response.stepId}: status ${response.status}`);
});
Parameters
ParameterTypeNotes
params
JobDependencyDetails

Dependency details to add to the job.

Returns 
Promise<JobActionResponse>

A job action response indicating whether the dependency was added successfully

addHolds

Class Method
addHolds(paramsJobHoldDetails): Promise<JobActionResponse>

Add a hold for one or more steps on a job.

To get automatic notifications for step holds added to a job, subscribe to job notifications using NotificationManager.subscribeToJob . Refer to the Step Held websocket message for information.

Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
9
10
11
12
// Add a hold to multiple steps on a job. The hold has an expiration date and will be released on that date.
// If the hold did not have an expiration date, it will need to be released manually by calling releaseHolds.
const holdDetails: JobHoldDetails = {
 jobId: 'job3',
 stepIds: ['step5a', 'step5b'],
 scheduledRelease: new Date(2025, 11, 17)
};
const result: JobActionResponse = await jobsManager.addHolds(holdDetails);
const stepResponses = result.stepResponses;
stepResponses.forEach(response => {
 console.log(`Step ${response.stepId}: status ${response.status}`);
});
Parameters
ParameterTypeNotes
params
JobHoldDetails

Hold details to add to the job.

Returns 
Promise<JobActionResponse>

A job action response indicating whether the holds were applied successfully.

addJobComment

Class Method
addJobComment(jobIdstring, commentstring): Promise<string>

Add a comment to a job.

Use dark colors for code blocksCopy
1
const commentId: string = await jobsManager.addJobComment('job3', 'Impediment encountered while at the job site.');
Parameters
ParameterTypeNotes
jobId
string

The id of the job to add the comment to.

comment
string

The comment to add.

Returns 
Promise<string>

The id of the added comment.

assignCurrentStep

Class Method
assignCurrentStep(jobIdstring, assignedTostring, assignedTypeAssignedType): Promise<boolean>

Assign the current step of a job.

To get automatic notifications for steps reassigned on a job, subscribe to job notifications using NotificationManager.subscribeToJob . Refer to the Step Reassigned websocket message for information.

Use dark colors for code blocksCopy
1
const success: boolean = await jobsManager.assignCurrentStep(jobId, 'cjones', AssignedType.User);
Parameters
ParameterTypeNotes
jobId
string

The id of the job to assign.

assignedTo
string

The user or group to assign the current step to. Not required if assignedType is Unassigned .

assignedType
AssignedType

The assignment type. Options include Unassigned , User or Group .

Returns 
Promise<boolean>

Returns whether the current step was successfully assigned.

assignStep

Class Method
assignStep(jobIdstring, stepIdstring, assignedTostring, assignedTypeAssignedType): Promise<boolean>

Assign one of the current steps on a job.

To get automatic notifications for steps reassigned on a job, subscribe to job notifications using NotificationManager.subscribeToJob . Refer to the Step Reassigned websocket message for information.

Use dark colors for code blocksCopy
1
const success: boolean = await jobsManager.assignStep(jobId, 'step7a', 'cjones', AssignedType.User);
Parameters
ParameterTypeNotes
jobId
string

The id of the job to assign.

stepId
string

The id of the current step in the job to assign.

assignedTo
string

The user or group to assign the step to. Not required if assignedType is Unassigned .

assignedType
AssignedType

The assignment type. Options include Unassigned , User or Group .

Returns 
Promise<boolean>

Returns whether the step was successfully assigned.

calculateJobStatistics

Class Method
calculateJobStatistics(paramsJobStatisticsDetails): Promise<JobStatistics>

Calculate job statistics (counts).

Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// Example 1:
// Return the number of jobs found with one or more properties with the string 'Parcel', grouped by priority.
const parcelSearch: JobStatisticsDetails = {
  search: 'Parcel',
  groupBy: 'priority'
};
// Get the results
const results: JobStatistics = await jobsManager.calculateJobStatistics(parcelSearch);

// Example 2:
// Return the number of jobs found that match a search criteria, grouped by job status.
// This query returns the number of open jobs assigned to one of two groups.
const jobStatusDetails: JobStatisticsDetails = {
  q: '"assignedType=\'Group\' AND closed=0 AND assignedTo IN (\'groupId123\', \'groupId456\')"',
  groupBy: 'job_status'
};
// Get the results
const results: JobStatistics = await jobsManager.calculateJobStatistics(jobStatusDetails);
const totalNumber = results.total;
const groupedValues: GroupedValue[] = results.groupedValues; // Total values divided into sections
Parameters
ParameterTypeNotes
params
JobStatisticsDetails

The search criteria for calculating statistics for jobs.

Returns 
Promise<JobStatistics>

The job statistics results for the search criteria.

closeJobs

Class Method
closeJobs(jobIdsstring[]): Promise<boolean>

Close jobs in the Workflow Manager system.

Parameters
ParameterTypeNotes
jobIds
string[]

The ids of the jobs to close.

Returns 
Promise<boolean>

Returns whether the jobs were successfully closed.

createJobs

Class Method
createJobs(jobTemplateIdstring, jobOverrides?CreateJobOverrides): Promise<CreateJobsResponse>

Creates one or more jobs in the Workflow Manager system.

Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
9
10
11
// Provide optional overrides for just the properties that need to be overwritten.
const jobOverrides: CreateJobOverrides = {
  numberOfJobs: 2,
  assignedType: AssignedType.User,
   assignedTo: 'cjones'
};

// Create jobs
const results = await jobsManager.createJobs('jobTemplate1', jobOverrides);
const createdJobIds: string[] = results.jobIds;
const automatic: boolean = results.autoExecuted;
Parameters
ParameterTypeNotes
jobTemplateId
string

The id of the template to create the job from.

jobOverrides
CreateJobOverrides

Override parameters when creating jobs. This overrides the defaults specified in the job template.

Returns 
Promise<CreateJobsResponse>

The job Ids of the newly created jobs and whether jobs were performed automatically.

deleteAttachment

Class Method
deleteAttachment(jobIdstring, attachmentIdstring): Promise<boolean>

Delete an attachment from a job.

Parameters
ParameterTypeNotes
jobId
string

The id of the job to delete the attachment from.

attachmentId
string

The id of the attachment to delete.

Returns 
Promise<boolean>

Returns whether the attachment was successfully deleted.

deleteJobs

Class Method
deleteJobs(jobIdsstring[]): Promise<boolean>

Delete jobs in the Workflow Manager system.

Parameters
ParameterTypeNotes
jobIds
string[]

The ids of the jobs to delete.

Returns 
Promise<boolean>

Returns whether the job was successfully deleted.

finishSteps

Class Method
finishSteps(jobIdstring, stepIdsstring[]): Promise<JobActionResponse>

Finish running one or more steps on a job.

To get automatic notifications for steps finished on a job, subscribe to job notifications using NotificationManager.subscribeToJob . Refer to the Step Finished websocket message for information.

Use dark colors for code blocksCopy
1
2
3
4
5
6
const response: JobActionResponse = await jobsManager.finishSteps(jobId, ['step7a', 'step7b']);
const success = response.success;
response.stepResponses.forEach(stepResponse => {
 // Do something with the step responses
 console.log(`Step ${stepResponse.stepId}, status: ${stepResponse.status}`);
});
Parameters
ParameterTypeNotes
jobId
string

The id of the job to perform actions on.

stepIds
string[]

List of current stepIds to be finished. If no stepIds are specified, then all current steps will be finished.

Returns 
Promise<JobActionResponse>

A job action response indicating whether the step was finished successfully.

getAttachmentBody

Class Method
getAttachmentBody(jobIdstring, attachmentIdstring): Promise<Blob>

Get a file attachment body.

Parameters
ParameterTypeNotes
jobId
string

The id of the job to retrieve the attachment for.

attachmentId
string

The id of the attachment on the job to retrieve.

Returns 
Promise<Blob>

The raw contents of the attachment.

getAttachmentUrl

Class Method
getAttachmentUrl(jobIdstring, attachmentIdstring, includeTokenboolean): Promise<string>

Get the url to a job attachment.

The url can be used to download file attachments or view linked attachments.

Use dark colors for code blocksCopy
1
2
3
4
// Get the attachment url
const url: string = await jobsManager.getAttachmentUrl('job3', 'attachment7');
// Open the link to download a file attachment or view a linked attachment
window.open(url);
Parameters
ParameterTypeDefaultNotes
jobId
string

The id of the job to retrieve the attachment for.

attachmentId
string

The id of the attachment on the job to retrieve.

includeToken
boolean
true

If true, includes the token as a query parameter. Default is true.

Returns 
Promise<string>

The job attachment url.

getAttachments

Class Method
getAttachments(jobIdstring): Promise<JobAttachment[]>

Get the list of attachments for a job.

Use dark colors for code blocksCopy
1
2
3
4
5
6
7
// Get the list of attachments for the job
const attachments: JobAttachment[] = await jobsManager.getAttachments('job3');
const numAttachments = attachments.length;
attachments.forEach(attachment => {
 // Do something with each attachment
 console.log(`Attachment ${attachment.alias}, id=${attachment.id}, url=${attachment.url}`);
});
Parameters
ParameterTypeNotes
jobId
string

The id of the job.

Returns 
Promise<JobAttachment[]>

The attachments associated with the job.

getJob

Class Method
getJob(jobIdstring, options?JobRequestOptions): Promise<Job>

Get the details of a job by jobId in the Workflow Manager system.

If no options are included in the request, just the basic details of the job will be returned. Options are required if extended property or hold information should be returned along with the basic properties of the job.

Use dark colors for code blocksCopy
1
2
3
4
5
6
7
// Options to retrieve hold information for the job
const options: JobRequestOptions = {
  holds: true
};

// Get the job with basic details and hold information
const job = await jobsManager.getJob('job1', options);
Parameters
ParameterTypeNotes
jobId
string

The id of the job to retrieve.

options
JobRequestOptions

Options for including additional attributes of the job.

Returns 
Promise<Job>

The details of the job.

getJobComments

Class Method
getJobComments(jobIdstring): Promise<JobComment[]>

Get the comments for a job.

Use dark colors for code blocksCopy
1
2
3
4
5
const comments: JobComment[] = await jobsManager.getJobComments('job3');
comments.forEach(comment => {
 // Do something with the comments
 console.log(`Comment ${comment.comment}, submitted by ${comment.lastModifiedBy} on ${comment.lastModified}`);
});
Parameters
ParameterTypeNotes
jobId
string

The id of the job to retrieve comments for.

Returns 
Promise<JobComment[]>

The comments for the job.

getJobDiagram

Class Method
getJobDiagram(jobIdstring): Promise<DiagramDetails>

Get the diagram details for a job.

Parameters
ParameterTypeNotes
jobId
string

The id of the job to retrieve the diagram for.

Returns 
Promise<DiagramDetails>

The diagram details.

getJobHistory

Class Method
getJobHistory(jobIdstring): Promise<JobHistory[]>

Get the history details for a job.

Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
9
const history: JobHistory[] = await jobsManager.getJobHistory('job3');

// Do something with the history
// Get the duration in seconds of how long it took to complete a step on the job
const history: JobHistory[] = [];
const finishedEntries = history.filter(h => h.action === JobHistoryAction.Finished)
finishedEntries.map(entry => {
 console.log(`Job ${entry.jobId}, step ${entry.stepId} was finished on ${entry.endDate} in ${entry.durationSeconds} seconds`);
})
Parameters
ParameterTypeNotes
jobId
string

The id of the job to retrieve history information for.

Returns 
Promise<JobHistory[]>

The detailed history of the job.

getJobLocation

Class Method
getJobLocation(jobIdstring): Promise<Geometry>

Get the location for the job. Job locations are returned using the WGS 1984 Web Mercator (Auxiliary Sphere) coordinate system (spatial reference 3857). Supported geometry types are Multipoint , Polyline and Polygon .

Refer to ArcGIS API for JavaScript for additional info on geometries.

Parameters
ParameterTypeNotes
jobId
string

The id of the job to retrieve the location for.

Returns 
Promise<Geometry>

The geometry location of the job.

queryJobs

Class Method
queryJobs(queryQuery): Promise<QueryResult>

Query jobs in the Workflow Manager system.

Refer to Search Jobs in the REST API for additional information on allowed properties for queries.

Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
// Example 1:
// Search for jobs using a simple search.
// This query returns jobs with the text 'Wetlands' in its properties, with the specified fields, and returns the first 1000 matches.
const simpleSearch: Query = {
 search: 'Wetlands',
 fields: ['jobId', 'jobName', 'jobStatus', 'priority'],
 start: 0,
 num: 1000
};
// Query for the results
const queryResults = await jobsManager.queryJobs(simpleSearch);

// Example 2:
// Search for jobs using multiple qualifiers.
// This query returns jobs that are not closed and are assigned to 'cjones', with the specified fields,
// and sorted by jobName then priority.
const query: Query = {
 q: '"assignedType=\'User\' AND closed=0 AND assignedTo=\'cjones\'"',
 fields: ['jobId', 'jobName', 'jobStatus', 'priority'],
 sortFields: [
   {field: 'jobName', sortOrder: SortOrderType.Asc},
   {field: 'priority', sortOrder: SortOrderType.Desc}
 ],
 start: 0
};

// Query for the results
const queryResults = await jobsManager.queryJobs(simpleSearch);
const rows = queryResults.results;
Parameters
ParameterTypeNotes
query
Query

The search criteria by which to find jobs.

Returns 
Promise<QueryResult>

The result of the job query.

refreshSteps

Class Method
refreshSteps(jobIdstring, stepIdsstring[]): Promise<JobActionResponse>

Sends a refresh message to the step to resume the checking of a geoprocessing service if it stopped.

Parameters
ParameterTypeNotes
jobId
string

The id of the job to refresh.

stepIds
string[]

List of current stepIds to be refreshed. If no stepIds are specified, then all current steps will be refreshed.

Returns 
Promise<JobActionResponse>

A job action response indicating whether the step was refreshed successfully.

releaseDependency

Class Method
releaseDependency(paramsJobDependencyDetails): Promise<JobActionResponse>

Release a dependency for one or more steps on a job.

To get automatic notifications for step dependencies released on a job, subscribe to job notifications using NotificationManager.subscribeToJob . Refer to the Step Hold Released websocket message for information.

Parameters
ParameterTypeNotes
params
JobDependencyDetails

Dependency details to remove from the job.

Returns 
Promise<JobActionResponse>

A job action response indicating whether the dependency was removed successfully

releaseHolds

Class Method
releaseHolds(paramsJobHoldDetails): Promise<JobActionResponse>

Release a hold for one or more steps on a job.

To get automatic notifications for steps holds released on a job, subscribe to job notifications using NotificationManager.subscribeToJob . Refer to the Step Hold Released websocket message for information.

Parameters
ParameterTypeNotes
params
JobHoldDetails

Hold data to remove.

Returns 
Promise<JobActionResponse>

A job action response indicating whether the step hold was removed successfully.

reopenJobs

Class Method
reopenJobs(jobIdsstring[]): Promise<boolean>

Reopen closed jobs in the Workflow Manager system.

Parameters
ParameterTypeNotes
jobIds
string[]

The ids of the jobs to reopen.

Returns 
Promise<boolean>

Returns whether the jobs were successfully reopened.

setCurrentStep

Class Method
setCurrentStep(jobIdstring, stepIdstring): Promise<JobActionResponse>

Set a step as the current step on a job.

Use dark colors for code blocksCopy
1
2
3
4
5
6
const response: JobActionResponse = await jobsManager.setCurrentStep(jobId, 'step7b');
// const success = response.success;
response.stepResponses.forEach(stepResponse => {
 // Do something with the step responses
 console.log(`Step ${stepResponse.stepId}, status: ${stepResponse.status}`);
});
Parameters
ParameterTypeNotes
jobId
string

The id of the job to to perform actions on.

stepId
string

The id of the step to set as current.

Returns 
Promise<JobActionResponse>

A job action response indicating whether the step was set as current successfully.

setJobLocation

Class Method
setJobLocation(jobIdstring, geometryGeometry): Promise<boolean>

Set a location of work for an existing job. Supported geometry types are Point , Multipoint , Polyline and Polygon .

Use dark colors for code blocksCopy
1
2
3
4
5
6
7
const point = new Point({
 x: -111.3,
 y: 52.68
});

// Update the job location
const result: boolean = await jobsManager.setJobLocation('job1', point);

Refer to ArcGIS API for JavaScript for additional info on geometries.

Parameters
ParameterTypeNotes
jobId
string

The id of the job to update the location for.

geometry
Geometry

The geometry location to associate with the job.

Returns 
Promise<boolean>

Returns whether the job location was successfully updated.

startSteps

Class Method
startSteps(jobIdstring, stepIdsstring[]): Promise<JobActionResponse>

Starts one or more steps on a job.

To get automatic notifications for steps started on a job, subscribe to job notifications using NotificationManager.subscribeToJob . Refer to the Step Started websocket message for information.

Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
// Start multiple steps, receive a StepInfoRequired message for one of the steps, and respond to server with a response.
// In this example, one of the started steps was a Question step. The server will send a StepInfoRequired message for
// the Question step and will wait for a response back to continue with the step.
// There is also a handler for when a step finishes running on the job.

// Get an instance of a NotificationManager
const jobId = 'job3';
const notificationManager = await ManagerFactory.getManager(NotificationManager, options);

// Created a handler for a StepInfoRequired message for a Question step.
const handleQuestionStepInfoRequired = (message: MessageDetails) => {
 // Types are not defined for each type of MessageDetails at this point, so need cast to any.
 const messageAsAny = message as any;
 const stepId: string = messageAsAny.stepId;
 const question: string = messageAsAny.question;
 type QuestionResponseType = {name: string, value: number};
 const questionResponses: QuestionResponseType[] = messageAsAny.questionResponses; // Options available to select from
 const canComment: boolean = messageAsAny.canComment;

 // Typically, the user would be prompted with the question and list of possible options to select from.
 // When a selection is made, the response would be sent back to server so that running of the step can continue.
 // In this example, use the first option in the list of questionResponses as the response to send back to server.

 // Construct the question response
 const selectedOption = questionResponses[0];
 const questionResponse = {
   msgType: 'StepInfoResponse',
   message: {
     jobId: message.jobId,
     stepId,
     questionResponse: selectedOption.value,
     comment: `User selected option ${selectedOption.name}` // Optional comment if a comment is allowed in the step
   }
 };
 // Send the question response to server
 notificationManager.send(questionResponse);
};

// Create a handler for job notification messages
const handleJobMessages = (message: NotificationMessage): Promise<void> => {
 switch (message.msgType) {
   case('StepInfoRequired'):
     handleQuestionStepInfoRequired(message.message);
     break;
   case ('StepFinished'):
     const stepIds: string[] = (message.message as any).stepIds;
     console.log(`Steps ${stepIds.join(', ')} were completed in job ${message.message.jobId}`);
     break;
   default:
     break;
 }
};

// Subscribe to job notifications for a job.
// Job notification messages will automatically get sent to the message handler 'handleJobMessages'.
const callbackId = notificationManager.subscribeToJob(jobId, handleJobMessages);

// Start steps on the job
const jobsManager = await ManagerFactory.getManager(JobsManager, options);
const response: JobActionResponse = await jobsManager.startSteps(jobId, ['step7a', 'step7b']);
const success = response.success;
response.stepResponses.forEach(stepResponse => {
 // Do something with the step responses
 console.log(`Step ${stepResponse.stepId}, status: ${stepResponse.status}`);
});
Parameters
ParameterTypeNotes
jobId
string

The id of the job to perform actions on.

stepIds
string[]

List of current stepIds to be started. If no stepIds are specified, then all current steps will be started.

Returns 
Promise<JobActionResponse>

A job action response indicating whether the step was started successfully.

stopSteps

Class Method
stopSteps(jobIdstring, stepIdsstring[]): Promise<JobActionResponse>

Stop one or more steps on a job.

To get automatic notifications for stopped steps on a job, subscribe to job notifications using NotificationManager.subscribeToJob . Refer to the Step Stopped websocket message for information.

Use dark colors for code blocksCopy
1
2
3
4
5
6
const response: JobActionResponse = await jobsManager.stopSteps(jobId, ['step7a', 'step7b']);
const success = response.success;
response.stepResponses.forEach(stepResponse => {
 // Do something with the step responses
 console.log(`Step ${stepResponse.stepId}, status: ${stepResponse.status}`);
});
Parameters
ParameterTypeNotes
jobId
string

The id of the job to perform actions on.

stepIds
string[]

List of current stepIds to be stopped. If no stepIds are specified, then all current steps will be stopped.

Returns 
Promise<JobActionResponse>

A job action response indicating whether the step was stopped successfully.

updateAttachment

Class Method
updateAttachment(paramsJobAttachmentDetails): Promise<boolean>

Update an attachment on a job.

Update alias and folder names for existing attachments associated with a job.

Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
9
// Provide details for updating an existing attachment
const attachmentDetails: JobAttachmentDetails = {
  jobId: 'job3',
  attachmentId: 'attachment7',
  alias: 'Location 2 Photo',
  folder: 'images2'
};
// Update the attachment
const success: boolean = await jobsManager.updateAttachment(attachmentDetails);
Parameters
ParameterTypeNotes
params
JobAttachmentDetails

Properties for updating an existing attachment on a job.

Returns 
Promise<boolean>

Returns whether the attachment was successfully updated.

updateJob

Class Method
updateJob(jobIdstring, jobUpdatesUpdateJobOverrides): Promise<boolean>

Update a job in the Workflow Manager system.

Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
// Include just the properties that require updating in the job
const jobUpdates: UpdateJobOverrides = {
 // Update basic properties
 jobStatus: 'In Progress',
 priority: 'Medium',

 // Update extended properties
 extendedProperties: [
   // Update 2 properties in table1 and 1 property from table2
   {identifier: 'table1.property3', value: '4'},
   {identifier: 'table1.property4', value: 'Zone8'},
   {identifier: 'table2.property5', value: 'Parcel3'}
 ],

 // Update related properties
 relatedProperties: {
   adds: [
     {
       tableName: 'table3',
       entries: [ // Add 2 rows to table3
         {properties: [{propertyName: 'property7', value: 'true'}, {propertyName: 'property8', value: '12.6'}]},
         {properties: [{propertyName: 'property7', value: 'false'}, {propertyName: 'property8', value: '17.3'}]},
       ]
     }
   ],
   updates: [
     // Update a row in table4 and table5
     {
       tableName: 'table4',
       entries: [
         {id: '1000001', properties: [{propertyName: 'property10', value: '10000'}, {propertyName: 'property11', value: 'cjones'}]}
       ]
     },
     {
       tableName: 'table5',
       entries: [
         {id: '1200002', properties: [{propertyName: 'property14', value: '19.1'}, {propertyName: 'property15', value: 'Z12'}]}
       ]
     }
   ],
   deletes: [
     // Delete a row from table6 and 2 rows from table7
     {tableName: 'table6', ids: ['1300001']},
     {tableName: 'table7', ids: ['1500008', '1500009']},
   ]
 }
};

// Update the job
const result: boolean = await jobsManager.updateJob('job1', jobUpdates);
Parameters
ParameterTypeNotes
jobId
string

The id of the job to update.

jobUpdates
UpdateJobOverrides

Properties of the job to update.

Returns 
Promise<boolean>

Returns whether the job was successfully updated.

upgradeJobs

Class Method
upgradeJobs(jobIdsstring[]): Promise<boolean>

Upgrade jobs with the latest diagram version.

Parameters
ParameterTypeNotes
jobIds
string[]

The ids of the jobs to upgrade.

Returns 
Promise<boolean>

Returns whether the jobs were successfully upgraded.

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.