0

I am getting List from an invocable method in flow. I have created a collection variable to store the values but I am not sure how to assign value of each element in collection to screen elements separately. For example: myVarCollection has values like {'abc','123','xyz','123'}. I want to assign it to different screen flow fields by using something like myVarCollection[0], myVarCollection[1] and so on..

2
  • welcome to SFSE! Please see How to Ask on getting the most from the Community. What have you tried so far (use edit. You'll need a loop and a counter
    – cropredy
    Jun 16 at 20:36
  • Thanks @cropredy. I tried loop and counter and assigned each value to different text variables. It worked.
    – N_S
    Jun 17 at 0:59

1 Answer 1

0

There is no direct flow support to fetch items from a collection by their index value

If your collections are of reasonable size, you can do the following:

  • Create a number variable iterationIndex used to count from 0,1, .. n
  • Use a Loop element over the collection
  • Within the for each element part of the loop, use a multi-branched Decision element that tests for the value of iterationIndex.
    • If 0, take current collection loop variable and assign to Screen element A
    • If 1, take current collection loop variable and assign to Screen element B
    • ...
  • Using an Assignment element, add 1 to iterationIndex
  • end loop

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.