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 / Sending email to perso...
Power Apps
Answered

Sending email to person selected on dropdown in Visitor Management App

(0) ShareShare
ReportReport
Posted on by 76

Please help people. 

 

I have built a visitor management app. The app asks the user to complete a form upon check-in to the building which the data is connected to a sharepoint list. I am trying to make the app send an email to notify the person they are visiting when they select the person's name from the dropdown list on the form then click submit. 

 

However, I keep getting an error indicating the "To" email value is not being passed... ?? and can't figure out why...?

 

This is the code I am using on the OnSuccess Action/Function: 

 

ResetForm(CheckinForm); Navigate(LandingHomePage); Office365Outlook.SendEmailV2(DataCardValue13.Selected.Email, "You have a visitor.", "Please respond to the lobby you have a visitor.")

 

DataCardValue13 is connected to a person/group column in the SharePoint list and it is pulling the correct data. 

 

I would also like to send the notification and include the visitor names with a approve or deny message back function through teams and would appreciate any recommendations for a simple powerautomate flow to build for that. 

 

Help is greatly appreciated.

 

 

PersonVisitingDataCard13.PNG
ErrorSideBar.PNG
CodeEmail.PNG
Categories:
  • narayan225 Profile Picture
    2,547 Moderator on at

    @PowerPete13 

     

    You are resetting the form before sending the email. When you reset the form, your datacard value is blank. Hence, the email is not getting sent.

     

    Try sending the email and then resetting the form.

     

    Hope this helps.

    Cheers!

  • PowerPete13 Profile Picture
    76 on at

    Thanks Narayan225. I removed both the form reset and navigate actions to test and I am still getting the same error. 

     

  • Verified answer
    narayan225 Profile Picture
    2,547 Moderator on at

    @PowerPete13 

     

    When you submit the form, it automatically resets the form. So, you should put this action when you submit the form.

     

    Another way to do this is to get the last submitted data and send an email.

    Office365Outlook.SendEmailV2(Form6.LastSubmit.Trainer.Email,"You have a visitor.","Please respond to the lobby you have a visitor.")

     

    Here form6 is my entry form and Trainer is my person column and Email is their email address. I have used this in a form just like yours and have checked it.

     

    Hope this helps.

    Cheers!

  • Verified answer
    PowerPete13 Profile Picture
    76 on at

    That seems to be the fix! (FormName.LastSubmit.DataColumnName.Email). Thanks for sharing your knowledge!

  • PowerPete13 Profile Picture
    76 on at

    Any code recommendations to include some of the form data in the email being sent? Specifically, the visitors name and phone number?

     

  • narayan225 Profile Picture
    2,547 Moderator on at

    @PowerPete13 

     

    You can use the same method to send the details from the form. However, you should use HTML to format your email message content.

     

    Set(emailMessage,"<p>Dear " & FormName.LastSubmit.ColumnName.DisplayName & ",</p>" & "<p> Please respond to the lobby, you have a folowing visitor:>/p> <table border='1'> <tbody><tr><td>Visitor Name:</td><td>" & FormName.LastSubmit.VisitorName & "</td></tr><tr><td>Visitor Email:</td><td>" & FormName.LastSubmit.VisitorEmail & "</td></tr></tbody></table><p>Best regards,<br>Automation</p>")
    
    Office365Outlook.SendEmailV2(FormName.LastSubmit.ColumnName.Email,"You have a visitor.",emailMessage, {IsHtml:true, Importance:"Normal"})
    

     

    Hope this helps.

    Cheers!

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 224 Super User 2026 Season 2

#2
WarrenBelz Profile Picture

WarrenBelz 189 Most Valuable Professional

#3
Mohsin Ali Profile Picture

Mohsin Ali 126

Last 30 days Overall leaderboard