cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Responsive Resident
Responsive Resident

Sending Email Based on the Role

Hello Everyone,

 

I have an App with a SharePoint List at the backend. I have added codes to send emails on Button click which are working perfectly. The code is fetching the email addresses from another Email lists (multiple lists for different roles, e.g. Admin, Read etc). So for example, if i want to send email to Admins then i will fetch the email addresses from the Admin List. Below the Code which is working perfectly fine.

 

Office365Outlook.SendEmailV2(
            Concat(
                'Admin List',
                Email,
                ";"
            ),
            "Subject -",
            "Message",
            )

 

However instead of managing multiple lists i have created single list with an additional column of roles (List Name: Access Control List). Now I am looking for sending emails if the persons email ID is there in the list and also he is having appropriate role defined. How can i do that please?

 

Below some details.

Old List Columns as below

List Name: Admin List

Columns: Name, Email

 

Old List Columns as below

List Name: Access Control List

Columns: Name, Email, Role

 

Thanks,

1 ACCEPTED SOLUTION

Accepted Solutions
Solution Specialist
Solution Specialist

Hi @AkshayManke 

 

Since all the data is in one list, you'd need to filter that list based on the role.

To do that, you can make use of the Filter function.

 

The adjusted formula could look something like that:

Office365Outlook.SendEmailV2(
            Concat(
                Filter('Admin List', Role = "Admin"),
                Email,
                ";"
            ),
            "Subject -",
            "Message",
            )

 

You probably noticed that I added this part: 

Filter('Admin List', Role = "Admin")

 

This makes sure it will only select the list entries where Role equals "Admin". Of course you'd need to adjust "Admin" based on the values you have in the Role column.

 

I hope this helps.

 

Kind regards,

Fabian


Please click Accept as Solution if my post answered your question. Like my answer? Consider giving it a Thumbs Up. Others seeking the same answers will be happy you did.

 

Please click Accept as Solution if my post answered your question. Like my answer? Consider giving it a Thumbs Up. Others seeking the same answers will be happy you did.

View solution in original post

2 REPLIES 2
Solution Specialist
Solution Specialist

Hi @AkshayManke 

 

Since all the data is in one list, you'd need to filter that list based on the role.

To do that, you can make use of the Filter function.

 

The adjusted formula could look something like that:

Office365Outlook.SendEmailV2(
            Concat(
                Filter('Admin List', Role = "Admin"),
                Email,
                ";"
            ),
            "Subject -",
            "Message",
            )

 

You probably noticed that I added this part: 

Filter('Admin List', Role = "Admin")

 

This makes sure it will only select the list entries where Role equals "Admin". Of course you'd need to adjust "Admin" based on the values you have in the Role column.

 

I hope this helps.

 

Kind regards,

Fabian


Please click Accept as Solution if my post answered your question. Like my answer? Consider giving it a Thumbs Up. Others seeking the same answers will be happy you did.

 

Please click Accept as Solution if my post answered your question. Like my answer? Consider giving it a Thumbs Up. Others seeking the same answers will be happy you did.

View solution in original post

Hi @FabianAckeret,

 

Your suggested solution worked perfectly. <Earlier i had the Role Column as Single Line Text hence from administration standpoint i changed it to Choice Type.> So now the formula looks like the below.

 

Filter('Admin List', Role.Value = "Admin")

 

 

Many Thanks for your Help...! 

 

Kind Regards,

Akshay

Helpful resources

Announcements
News & Announcements

Community Blog

Stay up tp date on the latest blogs and activities in the community News & Announcements.

Power Apps Community Call

Power Apps Community Call- January

Mark your calendars and join us for the next Power Apps Community Call on January 20th, 8a PST

PP Bootcamp Carousel

Global Power Platform Bootcamp

Dive into the Power Platform stack with hands-on sessions and labs, virtually delivered to you by experts and community leaders.

secondImage

Power Platform Community Conference On Demand

Watch Nick Doelman's session from the 2020 Power Platform Community Conference on demand!

Top Solution Authors
Top Kudoed Authors
Users online (8,218)