forEach does not iterate over portalUser.groups
Hi everybody,
I would like to build a workflow that reads out which user is logged in and which groups he belongs to.
To do this, I use $portalUser1.groups[0].title to access the first group in the list, for example, and display the title with the alert. This works perfectly well (Code inside the Notes). However, if I iterate over $portalUser1.groups with a ForEach loop to display the groups one after the other, it doesn't work.
This is what my workflow looks like:

In the ForEach loop I have the following code output in an alert or in the console, but unfortunately this does not work:
=$forEach1.item.title
I have already tried a lot, but have not found a solution and would be grateful for any help.
-
You're missing an equals sign in the Items input.
=$portalUser1.groups
1 -
Aaarg, thanks Ken, you made my day! I spent hours with that….
It's strange that you don't even get an error message in the console. It has obviously interpreted it as a string. It would be more clever here if you had to put a string in quotes so that it recognizes it as invalid input with a missing equals sign.
0 -
S. Burgert You're welcome! Sorry this can be a bit of a painful thing for authors to remember.
On the one hand, we could force you to have an ‘=’ character at the start every time, but on the other hand there is a convenience to the current support for literal values.
You are right - it is being interpreted as a string. It is likely looping through each character one at a time.
If you don't have an ‘=’ at the start of the input, it is assumed to be literal. It will be interpreted as either a boolean, a number or a string.
0 -
Ken Lyon Would it be an option to enforce an ‘=’ character if the literal starts with a dollar sign?
I've made the same mistake many times, and still do after years of building workflows. I'd accept having to use an expression for the few occasions where I have a literal value starting with $
4 -
Thumbs up
Berend Veldkamp Ken Lyon
1
Vous devez vous connecter pour laisser un commentaire.
Commentaires
5 commentaires