1

I need to create a workflow which runs any time an incident is created or updated (or one workflow for each).

When I create a workflow and set the "Table" to Incident, it will run every time an incident is created, but it doesn't run when an incident is updated. I've searched through the wiki and read a slideshow talk on workflow creation, but so far no dice.

Thanks.

Tommy Steimel
  • 771
  • 8
  • 16
  • Workflows do run when records are updated. If you create a workflow on incident with no condition, set to run anytime condition matches (i.e. all the time), and then you update an incident, the workflow will run. If you're workflow isn't running its either because the condition doesn't match, the incident is being updated in a non standard way or something is broken. – Joey Oct 17 '14 at 21:15

1 Answers1

3

You would need to create a business rule on the Incident table that would call your workflow each time there is an update:

var updateOwner = new GlideRecord('wf_workflow');
updateOwner.addQuery('name', '<workflow_name>');
updateOwner.query();
if (updateOwner.next()) {
   var wf = new Workflow();
   var workflowId = '' + updateOwner.sys_id;
   var vars = {};
   wf.startFlow(workflowId, current, current.operation, vars);
   gs.addInfoMessage('Workflow initiated.');
}
Sidetrak2
  • 46
  • 2
  • This technically works, but is not really best practice. Workflows already automatically run when updating a record without engines explicitly turned off. – Joey Oct 17 '14 at 21:14