Forum Discussion
Help Needed: Merging Email Lists from Lookup and Security Groups in a Fabric Pipeline
- 1 year ago
Hi,
Thanks for the response. I was finally able to resolve it as follows:
After the web activity that retrieves the members of the security groups, I added a notebook that processes the results and extracts the "mail" field from each member. This allowed me to generate a list of email addresses associated with the security groups.
Then, I added two "Set variable" activities:
The first one assigns the list of emails to a temporary variable inside the forEach loop.
The second one accumulates the emails into an accumulator variable, which allowed me to build the complete list of emails outside the forEach.
This approach enabled me to successfully retrieve all the email addresses from the security groups and use them in the subsequent steps of the pipeline.
Thank you very much for your response and for sharing this alternative!I followed the steps you suggested: I initialized the variables emailsListArray (with the static list from Lookup) and groupEmailsAccumulator (as an empty Array []).
Inside the ForEach over the group names, I added the get_group_id and get_group_members activities.
Then I added the Set variable activity to accumulate each group’s emails, using this expression as value:
@concat(variables('groupEmailsAccumulator'), activity('get_group_members').output.value)
However, I ran into two issues:
1. The Set variable activity inside the ForEach fails because the expression self-references the target variable (groupEmailsAccumulator), which isn’t allowed (cannot reference the variable being set).
2. The Set variable activity after the ForEach that creates finalEmailsList using:
union(variables('emailsListArray'), variables('groupEmailsAccumulator'))
shows this warning:
Expression of type: 'Array[Any]' does not match the field: 'value'. Expected type is 'object'
Do you have any suggestions on how to work around these limitations, or maybe another way to achieve this?
Thanks again for your help and your time!
Hi liney_marcela ,
Apologies for the delayed response.
Could you please try the following workarounds?
To fix the self-referencing error, create a temporary variable called tempAccumulator and inside the ForEach loop, first assign it the current value of groupEmailsAccumulator, then use tempAccumulator to build the new value by appending the current group’s members with @concat(...), which avoids referencing the variable being set. As for the type mismatch error when using @union, switch to an Append variable activity to build your final array gradually, or if you're stuck using Set variable, wrap the union result in an object like { "value": @union(...) }
If you're still facing challenges, feel free to let us know we’ll be glad to assist you further.
Looking forward to your response.
Best regards,
LakshmiNarayana.
- v-lgarikapat1 year ago
Community Support
Hi liney_marcela ,
I wanted to follow up and confirm whether you’ve had the opportunity to review the information provided super users . Should you have any questions or require further clarification, please don't hesitate to reach out.
We appreciate your engagement and thank you for being an active part of the community.
Best Regards,
Lakshmi Narayana