ServiceNow: How to create a workflow that runs on incident update?

萝らか妹 提交于 2019-12-08 05:35:55

问题


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.


回答1:


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.');
}


来源:https://stackoverflow.com/questions/26387079/servicenow-how-to-create-a-workflow-that-runs-on-incident-update

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!