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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Open new screen to sen...
Power Apps
Unanswered

Open new screen to send Slack message based on selected user

(0) ShareShare
ReportReport
Posted on by

I'm building an app that displays a user gallery of upcoming birthdays and work anniversaries based on a SharePoint list. I've got that working just fine.

 

My next step is to have an image that functions as a button (see Screen 1 below). This button opens a new screen where the user can send a message via Slack to the selected colleague from the previous screen. There are two things I'm trying to figure out:

 

  1. How can I get the selected user's name to populate in the second screen (see Screen 2 below)?
  2. Is there a way to post a Slack DM with the user's email address instead of username? I'm pretty sure our usernames are based on our emails, but we actually use different naming conventions for different email domains. (Or maybe there's a way to pull the user's email address then remove the domain?)

 

Screen 1: 

LarissaNewton_0-1699379706930.png

Screen 2:

LarissaNewton_1-1699380548927.png

 

Current Slack formula being used in the OnSelect field of the paper airplane icon in Screen 2. I want to replace #larissa-test-channel with a dynamic value based on the selected user.

 

 

Slack.PostMessage("#larissa-test-channel", Text(TextEmailMessage1), {as_user:true})

 

 

Thanks!

Categories:
I have the same question (0)
  • MudassarSZ365 Profile Picture
    591 on at

    Hi @Anonymous 

    For getting the selected user's name on the second screen:

    On Screen 1, set the OnSelect property of the button (the image you're using) to navigate to Screen 2 and pass the selected user's information. Assuming your gallery's selected item is Gallery1.Selected, and it has a field called Name, you’d write something like this:

    Navigate(Screen2, {SelectedUserName: Gallery1.Selected.Name})

    On Screen 2, use the context variable to populate the name in the desired text label or input. You can set the Text property of the label where you want the name to show up to:

    SelectedUserName

    For sending a Slack DM using the user’s email:

    You’ll need to work with Slack’s API. It’s a bit tricky since you want to map the email to the Slack user ID or username. Here’s a general approach:

    Use a Power Automate flow to handle the Slack API interaction. In Power Apps, use the OnSelect property of the send button to call this flow, passing the email of the selected user.

    In the flow, you would have an HTTP request to Slack's users.lookupByEmail API to get the user ID associated with the email.

    Once you have the user ID, use it in another HTTP request to chat.postMessage to send a DM to that Slack user.

    In Power Apps, it would look something like this on the OnSelect property of the send button:

    PowerAutomateFlowName.Run(Gallery1.Selected.Email, TextEmailMessage1.Text)

     

  • Community Power Platform Member Profile Picture
    on at

    Thanks so much! I got those first two parts working great. 

     

    I'm already using a flow to generate my SharePoint list of users with birthdays listed in their Delve profile. I wonder if I could add a step using your suggestion for the Slack API, but then put their user ID in a new column of the SharePoint list. If I can manage this, then I could pull that into the app for the post message action. 

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 765 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 343 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 272

Last 30 days Overall leaderboard