ServiceNow Learning 34: Wait for condition best practices to follow in ServiceNow.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-20-2023 12:56 AM
Hi Team,
Please follow below practices whenever you use Wait for Condition in Flow Designer. This is really helpful. It will help you to run your flow without getting the wait for condition stuck.
Practice 1 : Never put a wait for condition on date or date/time field.
Common Failure : In Flow Designer a wait-for-condition looks at a date. When this date is reached the flow should move forward. However it is stuck.
Cause
A wait-for-condition only updates when the source record receives an update. So for example, if the condition is state=closed, the flow will wait for that record to move to closed and then resolve the wait-for-condition. But if no update is received the flow cannot move.
This activity does not do regular checks on the source record. It only moved if the record moves so if you wait for a date to be reached it won't move forward unless the source record is updated.
Resolution
The duration activity is designed to work with dates and times. Unlike wait-for-condition it can monitor a record and pick up on date/time changes without the record having been updated.
Practice 2:
Please note that the Flow Designer "Wait For Condition" is not supported for relative data conditions and conditions which involve dot-walked fields.
Review the criteria below to validate if your Wait For Condition is valid.
The Wait for Condition action only evaluates the wait condition when there are changes to the Record you select.
A valid wait condition meets these criteria:
- Each condition evaluates a field from the table to which the record belongs.
- Note: Avoid conditions that dot-walk to another table or depend upon catalog item variables from a related record.
- Each condition specifies a field value change rather than a relative time period.
- Note: For conditions that depend on a specific duration, consider using Wait for a duration flow logic instead.
This is Documented under the Condition Evaluation Section of the "Wait For Condition action" Documentation here.
Practice 3: Wait for condition is stuck due to some reasons. Get the reasons below:
A record is not getting created on the [sys_rw_action] table, so the flow does not 'wake up' when the state is changed.
Resolution
In this case, moving the actions in the flow that related to other RITMs to a separate subflow can resolve the issue.
Additional Information
KB0955312 Flow is in "waiting" state even though approval or wait for condition has been satisfied
Practice 4: Flow stucks even when the condition is properly met.
Hope this helps.
Please mark this helpful if this helps you.
Regards,
Shamma