ReDirect Resources

ReDirect facilitates implementing a manual intervention point for redirecting a job in a flow from an external web application. A use case for this is the development of a Problem Job Dashboard to allow production personnel, who have no access to Switch, to resolve issues with a job that could not be handled within the flow programmatically.

There are two webhooks, one to inquire about held jobs and the other to redirect each job to one of the available outgoing connections. The inquiry response can pass additional job information back to the inquiring web application. The redirect request can pass back one or more items to be added to the job’s private data.

Download a sample Node.js Job Dashboard based on the Express framework using Pug.  With just a few minor changes, it should work with your ReDirect implementation.

Download JobDashboard

  1. Edit app.js and set the switchPassword constant to match your webhook password if you are requiring a credential and set the port constant to an unused port.
  2. Edit views\waitingJobs.pug to edit the table columns to match your job information. The JSON response is passed to pug so all you need to do is reference the specific items you want to display as td items. (Note: be careful to maintain the indents as this is important to pug.) Remember that your custom information is included in the job.jobinformation element so if you configured an item called description you would reference it as job.jobinformation.description.
  3. Edit appconfig.json to set switchHost to match your host name or ip address and switchPort to match the port identified as the Port for the switch Web Service in the Web Services section of Preferences. In the instances array, create an entry for each instance of ReDirect that you want to monitor. The value for name will appear under Instance and the values for inquire and redirect should match the configured webhook paths preceded by /scripting.

To run, open a command prompt (Windows) or Terminal (Mac) instance, set the working directory to the jobManager directory (where app.js can be found) and enter node app.js. Ctrl-C will stop the server.

From a browser, type in the host name or ip address and port to access the server, examples:  or http://localhost:3000

Clicking on the link under Inquiry will return a list of the currently held jobs. Uses the drop down menus to specify how to route each job, optionally add comments, and click Redirect Jobs which will move the jobs to the outgoing connection.  You can see the comments for the job by viewing the job’s private data variable “notes”.