General
This article describes the action scripts used in Fusion Manage to control Job Queue state transitions for the Integrator Fusion Manage Source V2 Module. These scripts are executed within Fusion Manage workflows to update job statuses during processing.
The scripts are designed to automate transitions between workflow states such as Processing, Complete, and Error, ensuring that job execution status is correctly maintained.
For general module behavior, see: [CROSS-REFERENCE: Fusion Manage Source Module V2]
Workflow Context
The scripts are used within the Job Queue Workspace workflow in Fusion Manage.
As illustrated in the workflow diagram, jobs move through the following states:
- Created
- Queued
- Pending
- Processing
- Complete
- Error
Transitions between these states are controlled programmatically using action scripts.
Script: JobQueueSetComplete
Purpose
Sets a job to the Complete state when processing finishes successfully or handles error completion transitions.
Behavior
- Checks the current workflow transition target state
- Performs a transition based on the evaluated state
Script
var state = item.workflowActions[0].transition.toState.shortName;
if(state == 'Proccessing') {
item.performWorkflowTransition(464);
}
if(state == 'Error') {
item.performWorkflowTransition(494);
}Details
- If the job is transitioning from Processing, it moves to Complete
- If the job is in Error, it triggers an error completion transition
Important Note
The state value 'Proccessing' appears as defined in the script and should match the configured workflow state name in Fusion Manage.
Script: JobQueueSetError
Purpose
Sets a job to the Error state when processing fails.
Behavior
- Checks if the job is not already in Complete
- Transitions the job to Error
Script
var state = item.workflowActions[0].transition.toState.shortName;
if(state != 'Complete') {
item.performWorkflowTransition(465);
}Details
- Prevents overwriting completed jobs
- Ensures failed jobs are properly marked
Script: JobQueueSetProcessing
Purpose
Sets a job to the Processing state when execution begins.
Behavior
- Checks if the job is not already completed
- Transitions the job to Processing
Script
var state = item.workflowActions[0].transition.toState.shortName;
if(state != 'Complete') {
item.performWorkflowTransition(462);
}Details
- Ensures jobs enter processing state correctly
- Prevents unnecessary transitions for completed jobs
Transition IDs
Each script uses specific workflow transition IDs:
- 462 – Transition to Processing
- 464 – Transition to Complete
- 465 – Transition to Error
- 494 – Error completion transition
These IDs must match the configured transitions in the Fusion Manage workflow and will differ between workspaces and tenants.
Implementation Notes
- Scripts are executed within Fusion Manage workflow actions
- The
item.workflowActionsobject provides access to the current transition context performWorkflowTransitionexecutes the defined transition by ID
Best Practices
- Verify that workflow state names match script conditions exactly
- Confirm transition IDs correspond to the correct workflow transitions
- Test scripts in a controlled environment before production use
- Avoid modifying scripts without understanding workflow dependencies