cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
RonaldR91
Level: Powered On

Simple daily push notification

I have a table of users who have either the role of "Admin" or "User", I would like to send notifications to the list of users who are "Admin" but I can't seem to create an array list of emails that are stored in the same table.

 

Here's what I have now:

 

PowerAppsNotification.SendPushNotification(
{
recipients: ["email@email.com"],
message:Label1_2.Text &" has a question about " &Label1.Text,
openApp:true
}
)

 

This works perfectly but only allows me to send the notification to one email. I would like to send it to all "admin" role emails stored in the table of users but I can't seem to work it out. 

 

Additionally, is it possible to send the notification to all who installed the app?

 

So 2 questions:

1- How can I add all emails from a table in the Recipients:  value of the notification function?

2- How do I send the notification to all users?

 

Thanks!

2 ACCEPTED SOLUTIONS

Accepted Solutions
TimRohr
Level 10

Re: Simple daily push notification

Two options...

 

1) Concat() can take a field from a table and build a longer string. So use it with your data to build a ";" delimited string of the addresses of your admins. Provided your sending function acts as typical email addressing, this should result in multiple recipients of the same message. If they should not see each other's address in the "To" portion of the header info, then you should use the second option, below.

 

2) Collect() your Admins out of your datasource, then use ForAll() to step through them, individually sending them to the SendPushNotification() function.

RonaldR91
Level: Powered On

Re: Simple daily push notification

Thanks for the quick feedback TimRohr!!!

 

Already tried concat before but it won't see create an array of strings which is needed for the Recipients value of the pushnotification function. 

 

What did work, is the ForAll() function. Although I still wonder if it's possible to get an array of strings from a table source to put as Recipients. Here's the codes I use that works now:

 

ForAll(Filter(USER_DATA, ROLE="Admin"),
 PowerAppsNotification.SendPushNotification(
  {
   recipients: [MAIL],
   message:Label1_2.Text &" has a question about " &Label1.Text & ":" & Char(10) & Char(10) & TextInput1.Text,
   params:Table({key:"QID", value:TID}),
   openApp:true
  }
 )
);

3 REPLIES 3
TimRohr
Level 10

Re: Simple daily push notification

Two options...

 

1) Concat() can take a field from a table and build a longer string. So use it with your data to build a ";" delimited string of the addresses of your admins. Provided your sending function acts as typical email addressing, this should result in multiple recipients of the same message. If they should not see each other's address in the "To" portion of the header info, then you should use the second option, below.

 

2) Collect() your Admins out of your datasource, then use ForAll() to step through them, individually sending them to the SendPushNotification() function.

TimRohr
Level 10

Re: Simple daily push notification

Sorry, should have been a comma delimited list... not semi-colon.

RonaldR91
Level: Powered On

Re: Simple daily push notification

Thanks for the quick feedback TimRohr!!!

 

Already tried concat before but it won't see create an array of strings which is needed for the Recipients value of the pushnotification function. 

 

What did work, is the ForAll() function. Although I still wonder if it's possible to get an array of strings from a table source to put as Recipients. Here's the codes I use that works now:

 

ForAll(Filter(USER_DATA, ROLE="Admin"),
 PowerAppsNotification.SendPushNotification(
  {
   recipients: [MAIL],
   message:Label1_2.Text &" has a question about " &Label1.Text & ":" & Char(10) & Char(10) & TextInput1.Text,
   params:Table({key:"QID", value:TID}),
   openApp:true
  }
 )
);

Helpful resources

Announcements
firstImage

PowerApps Monthly Community Call!

Join us next Wednesday for our Demo Extravaganza, October 16, 2019 8am PDT.

firstImage

Microsoft Business Applications Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

FirstImage

Power Platform World Tour

Coming to a city near you

thirdimage

PowerApps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

FourthImage

Join PowerApps User Group!!

Connect, share, and learn with your peers year-round

SecondImage

Power Platform Summit North America

Register by September 5 to save $200

Top Kudoed Authors
Users Online
Currently online: 376 members 5,598 guests
Please welcome our newest community members: