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 / Search a User's addres...
Power Apps
Answered

Search a User's address and send an e-mail / two forms

(0) ShareShare
ReportReport
Posted on by 131

Hello,

I have an issue about the searUserV2 and SendEmail V2 functions.

My app is a bit complicated and has several screens, I'll try to be clear :

 

- First screen : any user in the company can submit a new form to declare a problem. In this form, I put a Office365User.MyProfile().DisplayName function so that the current user doesn't have to write his own name. Let's take the example of "Bob"

(- When submitted, the forms' data fields, incl. User's name, are stored in an Excel table.) No problem for that.

 

-  Second Screen : a few specific users (= "Jack") can fill a new form to answer to "Bob". In this second form there are two types of fields :

   1) Bob's informations and question (incl. his DisplayName) : only displayed

   2) Various empty fields to be completed by "Jack". (these new datas are also stored in the corresponding line within the Excel table ).

So :

When "Jack" submits his answer, I would like "Bob" to be sent an email with the informations provided by "Jack".

But the problem is that I only have "Bob" s Display name.

 

How can I get "Bob"'s e-mail adress, based on his DisplayName so that I can use the SendEmailV2 function when submitting the new form, and put in the e-mail's body new datas based on the fields that "Jack" has just filled ? 

(please note I don't necessarily need the e-mail to be sent by "Jack")

 

I tried this in the button's OnSelect property :

SubmitForm(Form1_1);; Office365Outlook.SendEmailV2('Utilisateursd’Office365'.SearchUserV2({searchTerm:DataCardValue21.Text});Subject;Body)

It doesn't work and I think my formula is wrong.

Form is correctly submitted, but I have an error regarding the "SendEmail" function...

 

I thought i would perhaps better use a parallel PowerAutomate Flow instead of programming a new function in the app.

Could it be easier ?  

 

Thanks a lot for your help.

 

Romain

 

 

 

Categories:
I have the same question (0)
  • Verified answer
    NandiniBhagya20 Profile Picture
    4,667 Super User 2024 Season 1 on at

    Hi @RSygroves ,

    To fetch email id from display name you can use something like below - 

    First(Office365Users.SearchUserV2({searchTerm:DataCardValue21.Text, top:1}).value).Mail

  • RSygroves Profile Picture
    131 on at

    Thank you @NandiniBhagya20 

    It seems to work perfectly !

    Best regards.

     

  • RSygroves Profile Picture
    131 on at

    Sorry, but although the e-mail sending process works fine and the app doesn't return any error, I have a problem :

     

    When the e-mail arrives, its body is only "True".

    Here is my formula for the button's  OnSelect property :

    SubmitForm(Form1_1);;Office365Outlook.SendEmailV2(First('Utilisateursd’Office365'.SearchUserV2({searchTerm:DataCardValue21.Text}).value).Mail;"Réponse à votre déclaration";"Bonjour, une réponse a été apportée :" &Char(10) & DataCardValue22.Text & Char(10) & DataCardValue2.Text & Char(10) & DataCardValue8.Text & Char(10) & DataCardValue5.Text & Char(10) & DateValue2.SelectedDate & Char(10) & "Action effectuée :" & Dropdown5.Selected.'Action effectuée');;Navigate(Succès)

     Do you have any idea ?

    Best,

    R.

  • NandiniBhagya20 Profile Picture
    4,667 Super User 2024 Season 1 on at

    If you have written ResetForm function onSuccess property of your form, you can remove it from there and add it after SendEmail function. 

  • RSygroves Profile Picture
    131 on at

    Unfortunately, I didn't, the form's OnSuccess property is set to "false"

  • NandiniBhagya20 Profile Picture
    4,667 Super User 2024 Season 1 on at

    When you mentioned Body is "True" did it mean that email is sent to correct users but body part is empty or it meant the the body part of the email is correct rest is not 

     

  • RSygroves Profile Picture
    131 on at

    It means the email is sent to correct user but body part isn't empty, it just says "true" and nothing else :

    RSygroves_0-1665585402506.png

     

  • RSygroves Profile Picture
    131 on at

    Solved : 

    I didn't write the formula properly.

     

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

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 352 Most Valuable Professional

#2
11manish Profile Picture

11manish 192

#3
Valantis Profile Picture

Valantis 128

Last 30 days Overall leaderboard