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.
Methods
Method | Returns | Notes |
---|---|---|
addAttachment(params) | Promise<AddJobAttachmentResponse> | Add a file attachment to a job. |
addAttachmentLinked(params) | Promise<AddJobAttachmentResponse> | Add a linked attachment to a job. |
addDependency(params) | Promise<JobActionResponse> | Add a dependency for one or more steps on a job. |
addHolds(params) | Promise<JobActionResponse> | 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. |
calculateJobStatistics(params) | Promise<JobStatistics> | Calculate job statistics (counts). |
closeJobs(jobIds) | Promise<boolean> | Close jobs in the Workflow Manager system. |
createJobs(jobTemplateId, jobOverrides?) | Promise<CreateJobsResponse> | 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) | Promise<JobActionResponse> | 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. |
getAttachments(jobId) | 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. |
getJobComments(jobId) | Promise<JobComment[]> | Get the comments for a job. |
getJobDiagram(jobId) | Promise<DiagramDetails> | Get the diagram details for a job. |
getJobHistory(jobId) | Promise<JobHistory[]> | Get the history details for a job. |
getJobLocation(jobId) | 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 |
queryJobs(query) | Promise<QueryResult> | Query jobs in the Workflow Manager system. |
refreshSteps(jobId, stepIds) | Promise<JobActionResponse> | Sends a refresh message to the step to resume the checking of a geoprocessing service if it stopped. |
releaseDependency(params) | Promise<JobActionResponse> | Release a dependency for one or more steps on a job. |
releaseHolds(params) | Promise<JobActionResponse> | 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) | Promise<JobActionResponse> | 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 |
startSteps(jobId, stepIds) | Promise<JobActionResponse> | Starts one or more steps on a job. |
stopSteps(jobId, stepIds) | Promise<JobActionResponse> | Stop one or more steps on a job. |
updateAttachment(params) | Promise<boolean> | Update an attachment on a job. |
updateJob(jobId, jobUpdates, allowRunningStepId?) | Promise<boolean> | Update a job in the Workflow Manager system. |
upgradeJobs(jobIds) | Promise<boolean> | Upgrade jobs with the latest diagram version. |
addAttachment
Class MethodaddAttachment(params: JobAttachmentDetails): Promise<AddJobAttachmentResponse>
Add a file attachment to a job.
// 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
Parameter | Type | Notes |
---|---|---|
params | JobAttachmentDetails | The attachment information to add to the job. |
Returns
Promise<AddJobAttachmentResponse>
Basic information on the added attachment.
addAttachmentLinked
Class MethodaddAttachmentLinked(params: JobAttachmentDetails): Promise<AddJobAttachmentResponse>
Add a linked attachment to a job.
// 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
Parameter | Type | Notes |
---|---|---|
params | JobAttachmentDetails | The attachment details to associate to the job. |
Returns
Promise<AddJobAttachmentResponse>
Basic information on the added attachment.
addDependency
Class MethodaddDependency(params: JobDependencyDetails): Promise<JobActionResponse>
Add a dependency for one or more steps on a job.
// 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
Parameter | Type | Notes |
---|---|---|
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 MethodaddHolds(params: JobHoldDetails): 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.
// 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
Parameter | Type | Notes |
---|---|---|
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 MethodaddJobComment(jobId: string, comment: string): Promise<string>
Add a comment to a job.
const commentId: string = await jobsManager.addJobComment('job3', 'Impediment encountered while at the job site.');
Parameters
Parameter | Type | Notes |
---|---|---|
job | 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 MethodassignCurrentStep(jobId: string, assignedTo: string, assignedType: AssignedType): 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.
const success: boolean = await jobsManager.assignCurrentStep(jobId, 'cjones', AssignedType.User);
Parameters
Parameter | Type | Notes |
---|---|---|
job | string | The id of the job to assign. |
assigned | string | The user or group to assign the current step to. Not required if |
assigned | AssignedType | The assignment type. Options include |
Returns
Promise<boolean>
Returns whether the current step was successfully assigned.
assignStep
Class MethodassignStep(jobId: string, stepId: string, assignedTo: string, assignedType: AssignedType): 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.
const success: boolean = await jobsManager.assignStep(jobId, 'step7a', 'cjones', AssignedType.User);
Parameters
Parameter | Type | Notes |
---|---|---|
job | string | The id of the job to assign. |
step | string | The id of the current step in the job to assign. |
assigned | string | The user or group to assign the step to. Not required if assignedType is |
assigned | AssignedType | The assignment type. Options include |
Returns
Promise<boolean>
Returns whether the step was successfully assigned.
calculateJobStatistics
Class MethodcalculateJobStatistics(params: JobStatisticsDetails): Promise<JobStatistics>
Calculate job statistics (counts).
// 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
Parameter | Type | Notes |
---|---|---|
params | JobStatisticsDetails | The search criteria for calculating statistics for jobs. |
Returns
Promise<JobStatistics>
The job statistics results for the search criteria.
closeJobs
Class MethodcloseJobs(jobIds: string[]): Promise<boolean>
Close jobs in the Workflow Manager system.
Parameters
Parameter | Type | Notes |
---|---|---|
job | string[] | The ids of the jobs to close. |
Returns
Promise<boolean>
Returns whether the jobs were successfully closed.
createJobs
Class MethodcreateJobs(jobTemplateId: string, jobOverrides?: CreateJobOverrides): Promise<CreateJobsResponse>
Creates one or more jobs in the Workflow Manager system.
// 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
Parameter | Type | Notes |
---|---|---|
job | string | The id of the template to create the job from. |
job | 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 MethoddeleteAttachment(jobId: string, attachmentId: string): Promise<boolean>
Delete an attachment from a job.
Parameters
Parameter | Type | Notes |
---|---|---|
job | string | The id of the job to delete the attachment from. |
attachment | string | The id of the attachment to delete. |
Returns
Promise<boolean>
Returns whether the attachment was successfully deleted.
deleteJobs
Class MethoddeleteJobs(jobIds: string[]): Promise<boolean>
Delete jobs in the Workflow Manager system.
Parameters
Parameter | Type | Notes |
---|---|---|
job | string[] | The ids of the jobs to delete. |
Returns
Promise<boolean>
Returns whether the job was successfully deleted.
finishSteps
Class MethodfinishSteps(jobId: string, stepIds: string[]): 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.
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
Parameter | Type | Notes |
---|---|---|
job | string | The id of the job to perform actions on. |
step | 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 MethodgetAttachmentBody(jobId: string, attachmentId: string): Promise<Blob>
Get a file attachment body.
Parameters
Parameter | Type | Notes |
---|---|---|
job | string | The id of the job to retrieve the attachment for. |
attachment | string | The id of the attachment on the job to retrieve. |
Returns
Promise<Blob>
The raw contents of the attachment.
getAttachmentUrl
Class MethodgetAttachmentUrl(jobId: string, attachmentId: string, includeToken: boolean): Promise<string>
Get the url to a job attachment.
The url can be used to download file attachments or view linked attachments.
// 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
Parameter | Type | Default | Notes |
---|---|---|---|
job | string |
| The id of the job to retrieve the attachment for. |
attachment | string |
| The id of the attachment on the job to retrieve. |
include | boolean | true | If true, includes the token as a query parameter. Default is true. |
Returns
Promise<string>
The job attachment url.
getAttachments
Class MethodgetAttachments(jobId: string): Promise<JobAttachment[]>
Get the list of attachments for a job.
// 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
Parameter | Type | Notes |
---|---|---|
job | string | The id of the job. |
Returns
Promise<JobAttachment[]>
The attachments associated with the job.
getJob
Class MethodgetJob(jobId: string, 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.
// 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
Parameter | Type | Notes |
---|---|---|
job | 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 MethodgetJobComments(jobId: string): Promise<JobComment[]>
Get the comments for a job.
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
Parameter | Type | Notes |
---|---|---|
job | string | The id of the job to retrieve comments for. |
Returns
Promise<JobComment[]>
The comments for the job.
getJobDiagram
Class MethodgetJobDiagram(jobId: string): Promise<DiagramDetails>
Get the diagram details for a job.
Parameters
Parameter | Type | Notes |
---|---|---|
job | string | The id of the job to retrieve the diagram for. |
Returns
Promise<DiagramDetails>
The diagram details.
getJobHistory
Class MethodgetJobHistory(jobId: string): Promise<JobHistory[]>
Get the history details for a job.
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
Parameter | Type | Notes |
---|---|---|
job | string | The id of the job to retrieve history information for. |
Returns
Promise<JobHistory[]>
The detailed history of the job.
getJobLocation
Class MethodgetJobLocation(jobId: string): 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
Parameter | Type | Notes |
---|---|---|
job | string | The id of the job to retrieve the location for. |
Returns
Promise<Geometry>
The geometry location of the job.
queryJobs
Class MethodqueryJobs(query: Query): 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.
// 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
Parameter | Type | Notes |
---|---|---|
query | Query | The search criteria by which to find jobs. |
Returns
Promise<QueryResult>
The result of the job query.
refreshSteps
Class MethodrefreshSteps(jobId: string, stepIds: string[]): Promise<JobActionResponse>
Sends a refresh message to the step to resume the checking of a geoprocessing service if it stopped.
Parameters
Parameter | Type | Notes |
---|---|---|
job | string | The id of the job to refresh. |
step | 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 MethodreleaseDependency(params: JobDependencyDetails): 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
Parameter | Type | Notes |
---|---|---|
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 MethodreleaseHolds(params: JobHoldDetails): 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
Parameter | Type | Notes |
---|---|---|
params | JobHoldDetails | Hold data to remove. |
Returns
Promise<JobActionResponse>
A job action response indicating whether the step hold was removed successfully.
reopenJobs
Class MethodreopenJobs(jobIds: string[]): Promise<boolean>
Reopen closed jobs in the Workflow Manager system.
Parameters
Parameter | Type | Notes |
---|---|---|
job | string[] | The ids of the jobs to reopen. |
Returns
Promise<boolean>
Returns whether the jobs were successfully reopened.
setCurrentStep
Class MethodsetCurrentStep(jobId: string, stepId: string): Promise<JobActionResponse>
Set a step as the current step on a job.
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
Parameter | Type | Notes |
---|---|---|
job | string | The id of the job to to perform actions on. |
step | 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 MethodsetJobLocation(jobId: string, geometry: Geometry): Promise<boolean>
Set a location of work for an existing job. Supported geometry types are Point
, Multipoint
, Polyline
and Polygon
.
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
Parameter | Type | Notes |
---|---|---|
job | 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 MethodstartSteps(jobId: string, stepIds: string[]): 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.
// 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
Parameter | Type | Notes |
---|---|---|
job | string | The id of the job to perform actions on. |
step | 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 MethodstopSteps(jobId: string, stepIds: string[]): 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.
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
Parameter | Type | Notes |
---|---|---|
job | string | The id of the job to perform actions on. |
step | 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 MethodupdateAttachment(params: JobAttachmentDetails): Promise<boolean>
Update an attachment on a job.
Update alias and folder names for existing attachments associated with a job.
// 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
Parameter | Type | Notes |
---|---|---|
params | JobAttachmentDetails | Properties for updating an existing attachment on a job. |
Returns
Promise<boolean>
Returns whether the attachment was successfully updated.
updateJob
Class MethodupdateJob(jobId: string, jobUpdates: UpdateJobOverrides, allowRunningStepId?: string): Promise<boolean>
Update a job in the Workflow Manager system.
// 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
Parameter | Type | Notes |
---|---|---|
job | string | The id of the job to update. |
job | UpdateJobOverrides | Properties of the job to update. |
allow | string | Allow updating job properties when the specified step is running |
Returns
Promise<boolean>
Returns whether the job was successfully updated.