Genesys Cloud - Main

 View Only

Sign Up

  • 1.  Workflow Loop only iterates first 2 items (0,1) - not continuing despite Next Loop

    Posted 2 days ago

    Hi all,

    I'm building a Genesys Cloud Workflow triggered by the STA Topics event (v2.speechandtextanalytics.conversation.{id}.topics) and I'm running into an issue with loop behaviour.

    What I'm trying to do:
    Loop through Flow.jsonData.participants to extract the first available queueId, then continue with queue filtering and topic logic.

    What I've done so far:

    • Converted participants into a collection:
      State.participants = ToJsonCollection(Flow.jsonData.participants)
    • Created a loop with:
      • Index: State.participantLoopIndex
      • Max Loop Count: 10
    • Inside the loop, I tested with a minimal setup:
      • Send Notification: "DEBUG LOOP\nIndex: " + ToString(State.participantLoopIndex)
      • Followed by Next Loop

    Expected behaviour:
    The loop should iterate through all items (e.g. index 0, 1, 2, 3...)

    Actual behaviour:
    The loop only runs:
    Index: 0
    Index: 1

    Then it stops, with no errors.

    Additional details:

    • Participants count is correct (e.g. 4 or more)
    • Workflow trigger is firing correctly
    • Even when I remove all logic and keep only debug + Next Loop, the issue persists
    • All paths appear to lead to Next Loop

    Question:
    Has anyone experienced a loop stopping after the first 2 iterations in a Workflow?

    Is there any known limitation or specific configuration required for Loop / Next Loop to iterate through all items?

    Thanks in advance for any help!


    #API/Integrations

    ------------------------------
    Phaneendra
    Technical Solutions Consultant
    ------------------------------


  • 2.  RE: Workflow Loop only iterates first 2 items (0,1) - not continuing despite Next Loop

    Posted 16 hours ago

    Hi @Phaneendra Avatapalli,

    I have not seen the issue you mention. However, as alternative, you could perhaps use a Genesys Cloud Function to process the event and get the first queueid involved with in the conversation, in this way you avoid do the loop in the workflow.

    Regards,

    SG



    ------------------------------
    Saugort Dario Garcia
    Arquitecto de soluciones
    ------------------------------



  • 3.  RE: Workflow Loop only iterates first 2 items (0,1) - not continuing despite Next Loop

    Posted 10 hours ago

    Hi SG ,

    Thanks for the suggestion.

    That's an interesting approach using a Genesys Cloud Function to process the event and extract the first queueId would definitely simplify the workflow and avoid looping altogether.

    For now, I'll proceed with the workflow-based approach using Exit Loop, as I'd like to keep the logic within Architect if possible. But I can see how moving this to a function could be useful, especially if the logic becomes more complex or needs to be reused across multiple workflows.

    Appreciate the idea, I'll keep it in mind as an alternative 



    ------------------------------
    Phaneendra
    Technical Solutions Consultant
    ------------------------------



  • 4.  RE: Workflow Loop only iterates first 2 items (0,1) - not continuing despite Next Loop
    Best Answer

    Posted 16 hours ago

    Hello Phaneendra

    I believe what you are hitting it the send notification action has a built in rate limit of 3 successful invocations per workflow execution. When the Send Notification action is successfully invoked 3 times within the same workflow execution, any subsequent invocations automatically take the failure path with an errorType of "ActionInvocationLimitExceeded". Since you're running a loop with Send Notification for debugging (iterations 0 and 1), and if your failure path is not connected or handled, the workflow will simply stop execution without errors. 

    My recommendations, the first being to add the failure output path to see why its stopping. If the failure path is not connected, the workflow execution will terminate silently when it encounters a failure scenario. 

    My next recommendation, since you're trying to extract the first available queueId from participants, you should:

    1. Remove the Send Notification action from your loop debugging
    2. Use a Decision action inside the loop to check if queueId exists:
      • Yes path: Set a variable with the queueId, then use Exit Loop to break out
      • No path: Use Next Loop to continue to the next participant
    3.  Ensure all paths connect to either Next Loop or Exit Loop
    4. After the loop exits, continue with your queue filtering and topic logic

    This approach will be more efficient and won't hit invocation limits.

    Hope this helps!



    ------------------------------
    Cameron
    Online Community Manager/Moderator
    ------------------------------



  • 5.  RE: Workflow Loop only iterates first 2 items (0,1) - not continuing despite Next Loop

    Posted 10 hours ago

    Hi,

    Thank you for the detailed explanation.

    I wasn't aware of the Send Notification invocation limit, and that explains why the loop was consistently stopping after a couple of iterations without any clear error. I did have the success paths wired, but I didn't fully account for the failure path being triggered due to the rate limit, which would have caused the workflow to terminate silently.

    Based on your suggestion, I'm going to change the approach and simplify the loop logic:

    • Remove the Send Notification action from inside the loop
    • Use a Decision to check if queueId exists on the current participant
    • If found, set State.queueId and use Exit Loop
    • If not, use Next Loop to continue
    • Ensure all paths correctly lead to either Next Loop or Exit Loop

    This approach is definitely cleaner and more efficient since I only need the first valid queueId, rather than iterating through everything.

    I'll implement this and test it out - really appreciate the guidance!



    ------------------------------
    Phaneendra
    Technical Solutions Consultant
    ------------------------------



  • 6.  RE: Workflow Loop only iterates first 2 items (0,1) - not continuing despite Next Loop

    Posted 10 hours ago

    Hi Phaneendra,

    To add to what Cameron mentioned above (Also, good to know that there is a Send Notification limit of 3, I don't believe I knew that!), if you still want to have the Send Notification, maybe remove it from the loop and just prepare a single string in the loop.

    So instead of the "Send Notification" component, just have an "Update Data" in there with a string variable, and keep adding the information that you need to that string during each Loop.

    After the Loop is done, you can use "Send Notification" just once, to avoid that limit.



    ------------------------------
    Marcello Jabur
    ------------------------------



  • 7.  RE: Workflow Loop only iterates first 2 items (0,1) - not continuing despite Next Loop

    Posted 10 hours ago

    Hi,

    Thanks for adding that@Marcello Jabur that's a helpful suggestion.



    ------------------------------
    Phaneendra
    Technical Solutions Consultant
    ------------------------------