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
Super User
Super User

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
Super User
Super User

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
secondImage

Experience what’s next for Power Apps

Join us for an in-depth look at the new Power Apps features and capabilities at the free Microsoft Business Applications Launch Event.

Power Apps Community Call

Power Apps Community Call: February

Did you miss the call? Check out the Power Apps Community Call here.

New Power Super Users

Congratulations!

We are excited to announce the Power Apps Super Users!

New Badges

New Solution Badges!

Check out our new profile badges recognizing authored solutions!

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