官术网_书友最值得收藏!

  • Learning ServiceNow
  • Tim Woodruff
  • 368字
  • 2021-07-09 18:48:24

Wait for Condition

The Wait for Condition workflow activity allows you to specify either a simple condition (using the condition builder), or a script. Unlike a normal javascript function (but similar to many similar script fields in ServiceNow, the aim of this script is not to return anything, but to set a pre-defined variable (called answer) to either true or false. You can do just about anything you can do in any server-side script, but whatever that variable is set to after the script finishes running, will be the result:

One thing to keep in mind about the Wait for Condition workflow activity, is that it is only (re-)evaluated when the record that the workflow is associated with, is updated. Any update will trigger the re-evaluation of this condition, but updating another record will not. To help us understand this, let's imagine the following scenario:

Imagine that you've got a workflow associated to an Incident ticket, and that workflow runs a script which generates another outside record in a custom table that extends Task [task]. Next, the workflow transitions to the Wait for Condition activity. The Wait for Condition activity is configured to wait until that outside record is closed, which it determines via a script. However, the Incident workflow won't have any idea that you've updated the outside record once it is closed, so you'll need to give the incident a little nudge to get it to re-run the evaluation script.

One effective way of solving this problem, is to associate these two tasks together, and then use a business rule to update the parent record. For example, when generating the record in the custom task table, you can populate the Parent [parent] field with a reference to the record that the workflow is running on. You can then use a business rule on that custom table, that runs when it's closed, and updates the parent record by adding a work note. That will effectively nudge the record, and the workflow will re-evaluate the condition.

As with most records that have both a Condition builder field, and a Condition script field, those fields in the Wait for Condition activity must both evaluate to true, if used.

主站蜘蛛池模板: 铅山县| 尚义县| 高密市| 新安县| 黎川县| 修文县| 社旗县| 中方县| 台东县| 海林市| 广饶县| 新邵县| 南靖县| 通江县| 库车县| 哈尔滨市| 武威市| 樟树市| 荆门市| 石渠县| 铜川市| 馆陶县| 湖南省| 丹棱县| 习水县| 安多县| 江油市| 文昌市| 万山特区| 湟源县| 张北县| 玉溪市| 治县。| 和顺县| 澳门| 青州市| 原阳县| 大名县| 荆门市| 千阳县| 宜昌市|