cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
AkshayManke
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
FabianAckeret
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
FabianAckeret
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
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Power Apps June 2021

June Power Apps Community Call

Did you miss the call? Check out the recording here!

Top Solution Authors
Top Kudoed Authors
Users online (34,458)