Flow script that adds to a flow variable value in a "For each item in" action

Bidduam
Tera Guru

So I have a flow that is ultimately looking up a group, that bit is working and I can see in the flow that it goes through and finds all records, and gets quite a bit of information about each user.

 

For an email I need to show all members of the group - simply just want the get the display name.

I have a flow variable I've called:

Label: Members List

Name: members_list

Type: string

 

I have a action in the flow "For each item in group"

Then I have a "Set Flow Variables" with the following script:

var currentList = fd_data.flow_var.members_list || "";

var displayName = fd_data._2__look_up_group_members.group_members.displayName;

if (currentList) {
    currentList += ", " + displayName;
} else {
    currentList = displayName;
}

fd_data.flow_var.members_list = currentList;

 

The value of members_list is coming back blank.

 

Anyone know what is missing?

1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron
Tera Patron

@Bidduam 

check how it can be done, I shared outcome

AnkurBawiskar_0-1754281690140.gif

 

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

View solution in original post

2 REPLIES 2

Ankur Bawiskar
Tera Patron
Tera Patron

@Bidduam 

check how it can be done, I shared outcome

AnkurBawiskar_0-1754281690140.gif

 

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Bidduam
Tera Guru

As per usual @Ankur Bawiskar it works as expected now - thank you a heap.