Flow variable Value Retention not happening when using the variable inside do the foloowing
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
6 hours ago
Hi All,
I have a requirement on demand table and I am generating few demand tasks and approvals for demand record.
Now in this flow for one of the approvals if it gets rejected I need to go back to a previous step and regenerate the tasks and the approval that was rejected. It needs to configurable like a if I want 5 times I can configure the flow variable to 5 and so on.
While I implemented this when I am checking the variable in a if condition like if the count is less than 5 it after the rejection of approval it should increase the counter and so on until it reaches and that is when the loop is exited.
I have declared the initial value to 0 outside of do the following until loop and when the comparison happens the value of the flow variable always is 0 and the increment happens on the current value and it is always stays to 1 . It is not retaining the value of the flow variable. Please note that inside this do the following there are multiple tasks that have wait for condition as well.
- Labels:
-
Best Practices
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
6 hours ago
I think it's known thing
check below
Flow Designer | Do the following until loop | limit iteration number
Increment integer flow variable in each loop until variable reach 5 not working with below approach
💡 If my response helped, please mark it as correct ✅ and close the thread 🔒— this helps future readers find the solution faster! 🙏
Ankur
✨ Certified Technical Architect || ✨ 10x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
6 hours ago
So is it something that can not be achieved ? or is there an alternative to this ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
5 hours ago
Earlier I had a boolean variable so for that it used to work fine but it was only one check hence I went for counter to increase the cyclic check and tasks generation
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
6 hours ago
Hi @Anubhav24
Could you please try removing the Wait for Condition step and then check the behavior of the flow? This will help determine whether the issue is related to the wait condition or the flow variable itself.
Refer the below thread as well
https://www.servicenow.com/community/developer-forum/flow-variables-not-calling-correctly-in-do-unti...
If my answer has helped with your question, please mark my answer as accepted solution and give a thumb up.
Thank You