Legacy Dev Forum Posts

 View Only

Sign Up

Loop StringCollection to build query string for Data Action

  • 1.  Loop StringCollection to build query string for Data Action

    Posted 06-05-2025 19:10

    BusinessSystemsDev | 2019-08-15 15:33:33 UTC | #1

    I am building an Inbound Call Flow in Architect. I have a Custom Data Action that is returning an StringCollection array of AccountIds related to a Contact. The returned data looks like the following:

    { "AccountIds": [ "0015000000XXXXXXXX", "0013000000XXXXXXXX" ] }

    I need to use those AccountIds to then query additional data via another custom data action. In order to use the AccountIds in an "AccountId IN ('...', '...'), I am looping the data and then building a string of the ids that can be passed into the query. Ideally, the querystring variable will look like : '0015000000XXXXXXXX', '0013000000XXXXXXXX'

    I was able to get this to work in the Inbound Email Flow. But when I do this in the Inbound Call Flow, the querystring does not appear to build correctly.

    Am I over-complicating this? Is there a better way to do this?


    BusinessSystemsDev | 2019-08-15 16:03:41 UTC | #2

    I think I am incorrect in my initial assessment of my issue. I believe I'm failing in the initialization of my string variable.

    I am trying to build an expression like:

    Flow.AccountIdsQueryString + "'" + Flow.AccountIds[Flow.Count] + If((Count(Flow.AccountIds) - 1) != Flow.Count, "', ", "'")

    Flow.AccountIdsQueryString is the variable in which i am trying to put my AccountIds. I need that variable to start out as blank, and then build on the IDs as I loop through.

    I have been unable to properly declare that variable for use.


    MelissaBailey | 2019-08-15 16:09:21 UTC | #3

    What do you have set as the initial value of Flow.AccountIdsQueryString? Either the expression NOT_SET or a literal of `""` should work


    BusinessSystemsDev | 2019-08-15 16:23:12 UTC | #4

    I've tried using NOT_SET and the call fails in debug when trying to assign value to the variable during the loop.

    I just ran an additional test using the literal of " ", and that appears to have worked. I swear I had tried that earlier, but clearly i'm wrong.

    Thank you for your assistance, it looks my issue is sorted out!


    system | 2019-09-15 16:23:13 UTC | #5

    This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.


    This post was migrated from the old Developer Forum.

    ref: 5796