web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Building the recipient...
Power Apps
Answered

Building the recipient list for PowerAppsNotifications

(0) ShareShare
ReportReport
Posted on by 43

Hi,

I'm having trouble building the list of recipients for a PowerAppsNotification action. If I add them manually in like this -

 

 

PowerAppsNotification.SendPushNotification(
		{
			recipients:["email.address@example.com","email.address2@exmaple.com"],
			message: "This is a test message",
			params: Table({key: "NotificationTripID", value: editItem.ID}),
			openApp: true
		}
)

 

This works fine. If I use "set" to assign it via variables this works as well -

 

Set(TripLeaderEmail,editItem.'Trip Leader'.Email);
Set(TripMemberEmails, Concat(editItem.'Trip Members', Email, ","));
Set(TripExpertEmail, editItem.'Trip Expert'.Email);

PowerAppsNotification.SendPushNotification(
		{
			recipients:[TripLeaderEmail,TripExpertEmail,TripMemberEmails],
			message: "This is a test message",
			params: Table({key: "NotificationTripID", value: editItem.ID}),
			openApp: true
		}
)

 

However, if I try and add all 2 or 3 variables as a string like

 

Set(TripLeaderEmail,editItem.'Trip Leader'.Email);
Set(TripExpertEmail, editItem.'Trip Expert'.Email);

Set(NotificationList, TripLeaderEmail & "," & TripExpertEmail);

PowerAppsNotification.SendPushNotification(
		{
			recipients:[NotificationList],
			message: "This is a test message",
			params: Table({key: "NotificationTripID", value: editItem.ID}),
			openApp: true
		}
)

 

 

I receive the following error
"code": "InvalidPrincipalIdOrMail",
"message": "The recipient 'email.address@example.com,email.address2@example.com' is not a recognized email address or object identifier in the directory."

If I try and add a char(34) to it like so

 

Set(NotificationList, Char(34) & TripLeaderEmail & Char(34) & "," & Char(34) & TripExpertEmail & Char(34));

PowerAppsNotification.SendPushNotification(
		{
			recipients:[NotificationList],
			message: "This is a test message",
			params: Table({key: "NotificationTripID", value: editItem.ID}),
			openApp: true
		}
)

 

 

I receive the following error

"code": "InvalidPrincipalIdOrMail",
"message": "The recipient '\"email.address@example.com\",\"email.address2@example.com\"' is not a recognized email address or object identifier in the directory."

How can I build the "NotificationList" variable such that it can be used in the PowerAppsNotification command?

 

Thanks!
Dylan

Categories:
  • v-bofeng-msft Profile Picture
    Microsoft Employee on at

    Hi @baarsd :

    Firstly,let me explain why you encounted this problem.

    The key is that [NotificationList] can not parse the code in the variable NotificationList, but use it as a value (string).

    Secondly,please try this code:

     

    Set(TripLeaderEmail,editItem.'Trip Leader'.Email);
    Set(TripExpertEmail, editItem.'Trip Expert'.Email);
    
    Set(NotificationList, [TripLeaderEmail,TripExpertEmail]);
    
    PowerAppsNotification.SendPushNotification(
    		{
    			recipients:NotificationList,
    			message: "This is a test message",
    			params: Table({key: "NotificationTripID", value: editItem.ID}),
    			openApp: true
    		}
    )

     

    Best Regards,

    Bof

  • baarsd Profile Picture
    43 on at

    Hi @v-bofeng-msft 

    That works. One question - if any of the variables are empty (e.g. TripExpertEmail) it errors with "InvalidNotificationRecipients"

     

    Other than some if IsEmpty statements to build the NotificationList variable, do you see anything else that could be done?


    Thanks!
    Dylan

  • Verified answer
    v-bofeng-msft Profile Picture
    Microsoft Employee on at

    Hi @baarsd :

    Please try this code:

    Set(TripLeaderEmail,editItem.'Trip Leader'.Email);
    Set(TripExpertEmail, editItem.'Trip Expert'.Email);
    ClearCollect(NotificationList, [TripLeaderEmail,TripExpertEmail]);
    RemoveIf(NotificationList,IsBlank(Value));
    PowerAppsNotification.SendPushNotification(
    		{
    			recipients:NotificationList,
    			message: "This is a test message",
    			params: Table({key: "NotificationTripID", value: editItem.ID}),
    			openApp: true
    		}
    )

    Best Regards,

    Bof

  • baarsd Profile Picture
    43 on at

    Thanks @v-bofeng-msft! Works a treat.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 360 Super User 2026 Season 2

#2
M Bilal Khan Profile Picture

M Bilal Khan 325

#3
Mohsin Ali Profile Picture

Mohsin Ali 232

Last 30 days Overall leaderboard