Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

For Each Item flow logic how to get the consolidated output

Jamsheer1
Tera Guru

while creating a record I need to get related list of records and perform a REST action for each record . I'm using this flow and its working fine however I've no idea how we can get the final output to a variable.

Basically each REST response will return an unique reference and I wanted to update the concatenate value of response to a field in the table.

find_real_file.png

jamsheer

8 REPLIES 8

I tried this before and only got the value of the last element in the loop as a "concatenated value".

It seems like I would have to input the concatenated value from the previous loop as an input to the concatenation step. How do I get the output parameter the concatenation script as an input parameter so the values will be concatenated?

When I tried this before I was unable to use the 'sumoutput' in the Update Record step and I was only able to get the last iteration record. 

Whats the content of your script to concatenate value action?

 

Hi Jamsheer,

I believe this is addressed in Quebec with the introduction of the flow variables, More details here - https://developer.servicenow.com/blog.do?p=/post/quebec-fd-whats-new/

You can store the values in flow variables without updating in records and use it finally. 

Thanks

Community Alums
Not applicable
  • Create a flow variable 'response'.
  • Add new step under rest inside for each loop to set the flow variables.
  • Select the flow variable created and use below script inside it,
    fd_data.flow_var.response += fd_data._2.1_REST_CALL + '&&&';
    return fd_data.flow_var.response;
    NOTE : fd_data._2.1_REST_CALL have to be checked with your flow and &&& is used as separator for multiple responses.