VMware Cloud Community
jinhoe
Enthusiast
Enthusiast
Jump to solution

How to use Foreach Element

I've read official doc and watched youtube videos but still couldn't figure how to use foreach element.

What I want is to have accountName, displayName and ouContainer parameter changes for each iteration. I've set my userArray output as [{"accountName":"acc123","displayName":"dis123","ouContainer":{"id":"id123","label":"users","type":"AD:OrganizationalUnit"}}]

Please advice.

Screenshot 2023-05-22 111153.png

0 Kudos
1 Solution

Accepted Solutions
jinhoe
Enthusiast
Enthusiast
Jump to solution

If "promote" correctly the end result should look like this:

Screenshot 2023-05-23 at 10.18.41 AM.png

View solution in original post

0 Kudos
5 Replies
WhiteForEver
Enthusiast
Enthusiast
Jump to solution

Hi,

I think the iteration cannot be interactive. Or, technically, you can put user interaction element and wait for user’s answer, but have a feeling that’s not what you want. 
In your case, there is should be pre-defined array of accountName, displayName and ouContainer parameters where you can read the values from for each iteration. 



----------------------------------------------------------
Thank you for your feedback regarding my response.
If it has successfully resolved your issue, kindly mark it as RESOLVED

Take a look at my blog below.
https://www.clouddepth.com
jinhoe
Enthusiast
Enthusiast
Jump to solution

@WhiteForEver Thanks for your reply. Yes, I need to automate the process, so no user input.

I have defined an array of accountName (Array/string), displayName (Array/string) and ouContainer (Array/AD:OrganizationalUnit) but I can't map it to the input of foreach element. Example the input for accountName is only a string, not Array/string.

Screenshot 2023-05-22 132015.png

 

Tags (1)
0 Kudos
jinhoe
Enthusiast
Enthusiast
Jump to solution

Hi, I think I may have found out the problem. When I first dragged the foreach element, I was prompted to "promote" the binding. I ignore that, so that's why now I can't do that.

 

Once I re-create the foreach element and promote the binding, I can map the inputs to an array or variable. Still testing it now.

0 Kudos
jinhoe
Enthusiast
Enthusiast
Jump to solution

If "promote" correctly the end result should look like this:

Screenshot 2023-05-23 at 10.18.41 AM.png

0 Kudos
WhiteForEver
Enthusiast
Enthusiast
Jump to solution

Yeah. Making sure the inputs/variables are properly bound may be important... 🙂

Enjoy!



----------------------------------------------------------
Thank you for your feedback regarding my response.
If it has successfully resolved your issue, kindly mark it as RESOLVED

Take a look at my blog below.
https://www.clouddepth.com