Loop StringCollection to build query string for Data Action

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?

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.

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

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!

1 Like

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