- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-06-2024 01:30 PM - edited 07-06-2024 01:33 PM
I'm having problems with a very simple Flow.
Basically I'm running a default action from the Cornerstone Spoke to get a list of employees (it can only do 50 at a time, so it relies on pagination to step through the entire database).
There is a "Next Page Token" value that can be set in this action. I have set this value to reference the value of a string Flow Variable called nextToken.
After the action is run, the next step sets the Flow Variable nextToken to store the resulting Next Page Token. If the value is empty/null, it can be assumed that the action has reached the last page and can now stop. Otherwise, if there is a value, it should continue a Do Until loop until the value is empty.
Clearly the value of the variable is being set because the Do Until loop never satisfies the "until Flow Variable is EMPTY" logic. However, on every cycle of the loop, the input value for the Next Page Token (which, again, is referenced from Flow Variable nextToken) is empty/null, resulting in an infinite loop as it will keep pulling the first page of results, return a value for the Next Page Token, but never actually use the value to get to the next page.
Anyone have any ideas or experienced anything similar? I've attached some screenshots if it helps to visualize it.
Thanks!
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-07-2024 03:20 AM
Hi @Jeff Ward,
This is super weird, I tried something similar in the PDI and can see the same issue.
I also noticed that the Flow variable returns null outside of the loop as well even though it's updated within the loop.
But what's interesting is that if you remove the Timer action, it works as expected.
My only guess is that having the timer loses the pointer to the variable.
A few options you can explore:
- Remove timer (if you can)
- Don't use Flow variable, use a record's field instead
- Raise a Support Case to verify if this is a system defect
Cheers
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-07-2024 03:20 AM
Hi @Jeff Ward,
This is super weird, I tried something similar in the PDI and can see the same issue.
I also noticed that the Flow variable returns null outside of the loop as well even though it's updated within the loop.
But what's interesting is that if you remove the Timer action, it works as expected.
My only guess is that having the timer loses the pointer to the variable.
A few options you can explore:
- Remove timer (if you can)
- Don't use Flow variable, use a record's field instead
- Raise a Support Case to verify if this is a system defect
Cheers
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-16-2024 08:46 AM
Apparently this is a known issue that was resolved in Washington DC Patch 4 (search PRB1731825 here:)
(tried testing with the Timer removed but the Cornerstone Action was breaking, so it's unfortunately needed)
I still needed a workaround before we can get our instance patched though, so thank you for the idea to reference a record's field value instead!
I created a sys_property record with a string value that will specifically be used for the purpose of storing the nextPageToken value and this appears to be working great so far from testing.
For anyone interested, the new logic goes like this:
1. Update System Property Record (to set it to a blank value, in case something else was stored here or the Flow errored before it could reach the end)
2. (Loop begins) Do the following until nextPageToken is empty:
3. Look Up System Property Record (point it to the new sys_property)
4. Get Employees (Next Page Token = reference value from sys_property in Step 3)
5. Update System Property Record (update value to the new Next Page Token from Step 4)
6. Do whatever stuff needs to be done
7. Wait 5 seconds
8. (Loop back to Step 2 until condition is met)
9. Update System Property Record (again to make sure the value is blank for the next time the Flow runs)
Thanks again for taking the time to confirm this issue in a PDI and share your thoughts!