Hello everyone! I have been using Flow lately and have really been liking it. I have a problem though and was hoping for some help. I have a less advanced workaround for now, but ideally this is how I think it *should* work to be effective. I am new to SharePoint and Flow, so I apologize if I use any incorrect lingo.
I have a reference SharePoint item list with email addressess of people responsible for certain countries and it is on the level of the individual country. Each item/row contains an email and a country as seen below. This is going to be a master list which undergoes changes and will be sortable with different views for the "responsible person", region, email etc.... This cannot be stored within flow, since people not familiar with flow will be managing the list.
Country List SharePoint 1
Column "Email" is a person/group column and contains the emails of people in the company network.
So i am having trouble with getting the Flow to do two things.
First, go through the "Email" list and pull all unique emails into an array This array will be used for two purposes. First, it will send out an email to all email addresses whenever the flow is triggered (telling them I need something from them). The second thing is it will create an item on a Second Sharepoint, which is focused on the email recipient. One item per email address, like this (I apolgize that the data doesn't overlap):SharePoint 2 - By Email Recipient
To be clear, I only need help getting the unique email addresses into the array. The flow is already set up to email from the array and create items on the second SharePoint site.
The second thing I am having trouble with is having the countries associated with an email address get pulled into one SharePoint field (Like Latin America in the second screenshot). It is important that these countries are pulled at the time the flow is triggered so its also a snapshot in time of the countries the email address is reponsible for. In the event that a particular email address picks up responsibility for other countries for a period of time, this will capture that. This second SharePoint site will basically allow the person in charge of the email address to indicate that they did their job for the countries they are responsible for (in that last column). The SharePoint list item will be created based on the values in the array above (the email addresses), and then pull all countries from the first SharePoint. Perhaps this could be done by adding items into a variable using IF statements? Such as create an item from the first object in the array, and then for each row in the first SharePoint if the email matches the object in the array, put the value (the country) into a string array? Then repeat with object 2 etc... I have about 40 email addresses and only 10 or so have multiple countries.
If this second part isn't possible, I will still be greatful if anyone can still help with the first. Please inquire if I left anything out. I'm open to all suggestions! Thank you very much ahead of time!
-Ryan
Solved! Go to Solution.
Ok, so I had some time this weekend and solved my own problem. I'll post here how I did it in case anyone else is experiencing the same thing.
Problem#1 - Having an array take only unique items.
This is solved by using a 'union' command, which returns a single array with all the elements that are passed through it. If there are two objects with the same name in the final output, the last object with that name appears in the final object. Therefore, if you make the union go over the same array twice, you get unique values.
Set up like this:
Problem 2: Its probably better you scroll back and read my other attempts to explain this. Basically, I have a list with one email and one country per item. Most emails have more than one country associated with them. So now that I have problem 1 solved, how do I create a new item on a SharePoint where it shows one email and then all of the countries associated to it?
Problem solved.
I hope that makes sense! I will try to answer any questions if people have them.
If you want to grab all the email addresses from that first list, and then write them all to an array for use elsewhere in the Flow, have you tried:
1. Initialize an array variable
2. Retrieve all list items from List 1 using an unfilted Get Items action
3. Loop through each of the results with an Apply to Each action
4. Append the email value to the array variable you created in step one (action: Append to Array Variable)
5. Outside of the loop, create a Send an Email (V2) action
6. Insert the array variable in the recipients field. You will probably need to use a Split expression
Hi Jake, thank you very much for responding!
I have tried this and it will not work. Your solution only works if email addresses are not repeated in the list, hence why I'm trying to only grab UNIQUE email addresses. If one shows up 10 times, I need to only capture it once in the array.
This is also true for problem #2, where I use the array of unique email addresses to create items on a second SharePoint. If I grab all email addresses, then I'll create an item for each time an email address appears rather than only one item for each (unique) email address. I need to use the information in the first screen shot to create the table in the second image.
On a side note, for step 6 in your answer, you don't need a split expression for the email. Simply putting the array variable followed by a semi-colon is sufficient to have each email address populate the "to" field in an email.
I understand this is not a trivial thing to accomplish, I have already tried many things and have researched a lot on the internet (mostly from this forum). I'm really hoping someone here will be able to come up with a feasible solution!
Can you just run an If statement before every Append to Array action?
Revised Steps:
1. Initialize an array variable
2. Retrieve all list items from List 1 using an unfilted Get Items action
3. Loop through each of the results with an Apply to Each action
4. Check if the current email is already contained within the array using an If condition
5. If not... Append the email value to the array variable...
6. Outside of the loop, create a Send an Email (V2) action
7. Insert the array variable in the recipients field. You will probably need to use a Split expression
Hi @RyanFlow,
According to your description of requirement 1, I can give you the following flow configuration reference:
Step 1. Initialize two variables, one is "Email", type is String ,the other is "HTML Table "and type is Array, the former is used to store the value of the Email field, the latter is used to configure the data in the Html table.
Step 2.Use Append to string variable action to store the value of Rebate Type field contained in each item.
Then configure the fields that need to be displayed in the Html table in Append to array variable action.
After each item is traversed, need to empty the String variable "Email".
Step 3. the Array variable is configured in Create HTML table action and sent as the body of the message.
Email recipients will receive messages like the following:
According to your description of requirement 2, do you want to create a flow to automate storage the countries filed in a SharePoint list into the other SharePoint list, and classify them into multiple region?
Could you please describe more clearly what you need to implement? Such as step1, step2, step3, etc. That way, we can more clearly and quickly capture the functionality you want.
Best Regards,
Community Support Team _ Lin Tu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Jake, sounds like it would work, but I am not sure how to set it up. If you could show me an example of exactly how to set it up in flow I'd appreciate it.
Lin Tu, thank you very much for your detailed response! I am not familiar with HTML tables and some of the steps in your description I have never done. I will spend some time today playing around with flow trying your suggestion. In response to you asking me what I am looking for with step 2, I will try to provide a more clear answer of the overall plan.
I have a SharePoint item list (named SP1) with one item per country, along with an associated email address who is responsible for that country. The "Email" column in SP1 is the People/Group field type in SharePoint. The "Country" item is Single line of text
SharePoint 1
Step 1/Problem 1: Create an array of all unique email addresses. In this example, the array would have 3 components, ANZ, China, and Central Europe. They will be of the people/group type. Lets call it UniqueArray.
Current Workaround to Step 1:
This is how I am currently doing this, I created a different SharePoint (called Workaround sharepoint) and it is a custom list where I manually put in each email once. This gets rid fo the "unique" hurdle I'm trying to overcome. It is set it up as follows:
Step 2: Send an email to each address in the UniqueArray Array. This is set up as follows, and works perfectly fine (I redacted the array name since its called something else in my flow). In this example, the email would be sent to 3 individuals:
Email
Step 3/Problem 2: Create one item for each unique email address from SP1 (I assume this will utilize the UniqueArray variable) on a second SharePoint custom list (called SP2), and in that item have a list of the countries associated to that email in one field as shown below. I am guessing the field will be "Multiple lines of text". In this example, it is 3 email addresses, two of which are associated to more than one country. Please compare this to the first SS above of SP1. The highlighted boxes show how the countries associated to that email are all in one item.
SharePoint 2
My current workaround to step 3/problem 2:
I again utilize the workaround SharePoint where I have already manually copied/pasted the list of unique email addresses. I have also manually copied the list of countries associated to each email in a column (type: Multiple lines of text). So this information is all manually complied ahead of time in the workaround SharePoint and ready to be used, and is basically in a format where I can directly pull it to populate SP2. Here is a screenshot:
Create Item SP2
I think this might require a new variable to append the countries to for each unique email address prior to creating the item in SP2. Another comment is currently with the workarounds, the "send email" and "create item in SharePoint" are completely independent from each other. While they both get their data (emails/countires) from the same master list, the people I send the email to may not all need an item creation on SP2 (i'll use conditions to pick/choose). So I'd like to keep these processes independent if possible - they can pull from the same variables of course, I just can't have the email depend on the SharePoint item creation or vice versa.
Again, thanks a lot ahead of time! I realize I'm asking for a lot, but I have read some very clever and complex answers to other questions here and an hoping for the same! If any additional information or clarification is needed, please just ask.
-Ryan
Ok, so I had some time this weekend and solved my own problem. I'll post here how I did it in case anyone else is experiencing the same thing.
Problem#1 - Having an array take only unique items.
This is solved by using a 'union' command, which returns a single array with all the elements that are passed through it. If there are two objects with the same name in the final output, the last object with that name appears in the final object. Therefore, if you make the union go over the same array twice, you get unique values.
Set up like this:
Problem 2: Its probably better you scroll back and read my other attempts to explain this. Basically, I have a list with one email and one country per item. Most emails have more than one country associated with them. So now that I have problem 1 solved, how do I create a new item on a SharePoint where it shows one email and then all of the countries associated to it?
Problem solved.
I hope that makes sense! I will try to answer any questions if people have them.
My head hurts... 😛
Glad you got it sorted.
Sorry to come to an old thread ... I saw the "Union" solution, and thought that it's beautifully elegant and succinct. But I couldn't get any real understanding of how that all works, and if it's how that function is intended to be used, so in my head couldn't be sure of repetitive use or out of context use.
So I thought I'd offer a solution for anyone that would like to rely purely on internal logic (the Union solution is better!! 🙂 ...) then feel free to look at the following. It's obviously longer, but I just needed to know what I was looking at, was all.
If anyone would like to make this more succinct, feel free. (I'm sure some of it can be more elegant or smooshed)
Full flow
Essentially the repetitiveArrayVAR in my flow is the data that anyone might be handling, don't take it too literally, but if you have to then assume that I've done a SELECT to achieve just that one value to check.
For each item in the repetitive data, I will filter the newly created singularArrayVAR (which is our unique values) by that value, and if the count of items in that filter is 0 then I know that I need to add the current item to the unique array.
This will work with any data, but don't copy me verbatim. I made mine using a labelled array because when you're working with data from other sources it's unlikely to just be a simple set of string values. Where I've built my array entry in the compose, build yours accordingly. If you want to go fully unlabelled it's also possible, maybe easier, even, I've placed a screenshot at the end with a run that works that way.
Going through it step by step.
That's basically it!
Here's the unlabelled version, which essentially treats the data completely without blinkers, making the flow exportable, I guess. Essentially, you're setting your parse JSON to simply check a sting array.
You can watch this video to resolve your issue.Also request you to please subscribe this Power Automate channel
If anyone wants to efficiently get all unique records based on set fields in a JSON array / dataset, you can try this template: https://powerusers.microsoft.com/t5/Power-Automate-Cookbook/Get-Unique-Records/td-p/2191533
You are the best!
Thank you for sharing your solution with us.
Dear Community Members, We'd like to let you know of an upcoming change to the community platform: starting July 16th, the platform will transition to a READ ONLY mode until July 22nd. During this period, members will not be able to Kudo, Comment, or Reply to any posts. On July 22nd, please be on the lookout for a message sent to the email address registered on your community profile. This email is crucial as it will contain your unique code and link to register for the new platform encompassing all of the communities. What to Expect in the New Community: A more unified experience where all products, including Power Apps, Power Automate, Copilot Studio, and Power Pages, will be accessible from one community.Community Blogs that you can syndicate and link to for automatic updates. We appreciate your understanding and cooperation during this transition. Stay tuned for the exciting new features and a seamless community experience ahead!
We are excited to announce the Summer of Solutions Challenge! This challenge is kicking off on Monday, June 17th and will run for (4) weeks. The challenge is open to all Power Platform (Power Apps, Power Automate, Copilot Studio & Power Pages) community members. We invite you to participate in a quest to provide solutions to as many questions as you can. Answers can be provided in all the communities. Entry Period: This Challenge will consist of four weekly Entry Periods as follows (each an “Entry Period”) - 12:00 a.m. PT on June 17, 2024 – 11:59 p.m. PT on June 23, 2024 - 12:00 a.m. PT on June 24, 2024 – 11:59 p.m. PT on June 30, 2024 - 12:00 a.m. PT on July 1, 2024 – 11:59 p.m. PT on July 7, 2024 - 12:00 a.m. PT on July 8, 2024 – 11:59 p.m. PT on July 14, 2024 Entries will be eligible for the Entry Period in which they are received and will not carryover to subsequent weekly entry periods. You must enter into each weekly Entry Period separately. How to Enter: We invite you to participate in a quest to provide "Accepted Solutions" to as many questions as you can. Answers can be provided in all the communities. Users must provide a solution which can be an “Accepted Solution” in the Forums in all of the communities and there are no limits to the number of “Accepted Solutions” that a member can provide for entries in this challenge, but each entry must be substantially unique and different. Winner Selection and Prizes: At the end of each week, we will list the top ten (10) Community users which will consist of: 5 Community Members & 5 Super Users and they will advance to the final drawing. We will post each week in the News & Announcements the top 10 Solution providers. At the end of the challenge, we will add all of the top 10 weekly names and enter them into a random drawing. Then we will randomly select ten (10) winners (5 Community Members & 5 Super Users) from among all eligible entrants received across all weekly Entry Periods to receive the prize listed below. If a winner declines, we will draw again at random for the next winner. A user will only be able to win once overall. If they are drawn multiple times, another user will be drawn at random. Individuals will be contacted before the announcement with the opportunity to claim or deny the prize. Once all of the winners have been notified, we will post in the News & Announcements of each community with the list of winners. Each winner will receive one (1) Pass to the Power Platform Conference in Las Vegas, Sep. 18-20, 2024 ($1800 value). NOTE: Prize is for conference attendance only and any other costs such as airfare, lodging, transportation, and food are the sole responsibility of the winner. Tickets are not transferable to any other party or to next year’s event. ** PLEASE SEE THE ATTACHED RULES for this CHALLENGE** Week 1 Results: Congratulations to the Week 1 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge. Community MembersNumber SolutionsSuper UsersNumber Solutions Deenuji 9 @NathanAlvares24 17 @Anil_g 7 @ManishSolanki 13 @eetuRobo 5 @David_MA 10 @VishnuReddy1997 5 @SpongYe 9JhonatanOB19932 (tie) @Nived_Nambiar 8 @maltie 2 (tie) @PA-Noob 2 (tie) @LukeMcG 2 (tie) @tgut03 2 (tie) Week 2 Results: Congratulations to the Week 2 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge. Week 2: Community MembersSolutionsSuper UsersSolutionsPower Automate @Deenuji 12@ManishSolanki 19 @Anil_g 10 @NathanAlvares24 17 @VishnuReddy1997 6 @Expiscornovus 10 @Tjan 5 @Nived_Nambiar 10 @eetuRobo 3 @SudeepGhatakNZ 8 Week 3 Results: Congratulations to the Week 3 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge. Week 3:Community MembersSolutionsSuper UsersSolutionsPower Automate Deenuji32ManishSolanki55VishnuReddy199724NathanAlvares2444Anil_g22SudeepGhatakNZ40eetuRobo18Nived_Nambiar28Tjan8David_MA22 Week 4 Results: Congratulations to the Week 4 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge. Week 4:Community MembersSolutionsSuper UsersSolutionsPower Automate Deenuji11FLMike31Sayan11ManishSolanki16VishnuReddy199710creativeopinion14Akshansh-Sharma3SudeepGhatakNZ7claudiovc2CFernandes5 misc2Nived_Nambiar5 Usernametwice232rzaneti5 eetuRobo2 Anil_g2 SharonS2
On July 16, 2024, we published the 2024 release wave 2 plans for Microsoft Dynamics 365 and Microsoft Power Platform. These plans are a compilation of the new capabilities planned to be released between October 2024 to March 2025. This release introduces a wealth of new features designed to enhance customer understanding and improve overall user experience, showcasing our dedication to driving digital transformation for our customers and partners. The upcoming wave is centered around utilizing advanced AI and Microsoft Copilot technologies to enhance user productivity and streamline operations across diverse business applications. These enhancements include intelligent automation, AI-powered insights, and immersive user experiences that are designed to break down barriers between data, insights, and individuals. Watch a summary of the release highlights. Discover the latest features that empower organizations to operate more efficiently and adaptively. From AI-driven sales insights and customer service enhancements to predictive analytics in supply chain management and autonomous financial processes, the new capabilities enable businesses to proactively address challenges and capitalize on opportunities.
We're embarking on a journey to enhance your experience by transitioning to a new community platform. Our team has been diligently working to create a fresh community site, leveraging the very Dynamics 365 and Power Platform tools our community advocates for. We started this journey with transitioning Copilot Studio forums and blogs in June. The move marks the beginning of a new chapter, and we're eager for you to be a part of it. The rest of the Power Platform product sites will be moving over this summer. Stay tuned for more updates as we get closer to the launch. We can't wait to welcome you to our new community space, designed with you in mind. Let's connect, learn, and grow together. Here's to new beginnings and endless possibilities! If you have any questions, observations or concerns throughout this process please go to https://aka.ms/PPCommSupport. To stay up to date on the latest details of this migration and other important Community updates subscribe to our News and Announcements forums: Copilot Studio, Power Apps, Power Automate, Power Pages