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 Apps
Unanswered

Outlook365

(1) ShareShare
ReportReport
Posted on by 4
I have created an app that will be initiated by a Hiring Admin to advise there is a position vacancy, this gets emailed to HR, HR goes into the app to the HR screen, reviews what the Hiring Admin submitted and adds HR information, this goes back to the Hiring Admin, who will open the app to the Review & Approve screen. This final screen can either be approved and everything is done, or it could bounce between the Hiring Admin and HR to fine tune the specifics of hiring dates, etc. 
 
At each screen, I want an email to go to both HR and the Hiring Admin. HR is no problem because it goes to a distro list no matter who the actual HR person is that's updating the item. My issue is that there is a pool of 20 Hiring Admins who could be initializing this process and I don't know how to have the app recognize who this person is to then email them at the submission of each screen.
 
On my Submit New Request screen, I have a text field that saves the email address of the Hiring Admin to a column called "RequestingAdmin". On the next screen, for HR, I have a gallery through which all the pending items are listed, the item is selected and a corresponding form displays on that screen to be updated. This gallery has a text field that retrieves the email saved to RequestingAdmin. In my submit button, I have tried sending the email to this text field:
 
inputTo = ThisItem.RequestingAdmin
 
        Office365Outlook.SendEmailV2(
        inputTo.Text, // To 
 
I have tried making a text field that calls the Created by field and using that as the email recipient:
 
inputTo = ThisItem.'Created by'
 
        Office365Outlook.SendEmailV2(
        inputTo.Text, // To 
 
I have tried setting this email to a variable and using that as the email recipient: 
 
    Set(reqAdminHR,inputTo.Text);
        Office365Outlook.SendEmailV2(
        reqAdminHR, // To
Categories:
I have the same question (0)
  • Suggested answer
    VASANTH KUMAR BALMADI Profile Picture
    266 on at

    *** ChatGPT response to issue ***

    The Issue:

    • You have a dynamic pool of Hiring Admins, and you want the app to recognize which Hiring Admin initiated the process and send an email to them whenever necessary.
    • You're storing the Hiring Admin's email in the RequestingAdmin column, but the process of retrieving and using that email in subsequent screens isn't working as expected.

    Solution Breakdown:

    1. Ensure RequestingAdmin Email Is Stored Correctly:

      • You mentioned that the email of the Hiring Admin is stored in the RequestingAdmin column on the initial screen (when the Hiring Admin submits the position). Make sure this is working correctly, and the column is storing the email in the correct format.
      • Check: Verify that the RequestingAdmin column contains a valid email address and that the field is a Text field (not a Person/Group type field, as that would require accessing a specific property like .Email).
    2. Accessing the Correct Email on the HR Screen:

      • On the HR screen, when you display the gallery, you are correctly fetching the email from the RequestingAdmin field of the selected item. However, you should ensure that the email is being accessed properly as a string and passed correctly to the email sending function.
    3. Sending the Email Dynamically:

      • When you're sending the email, the inputTo.Text syntax is incorrect because inputTo is referencing a text input control, which doesn't work well if you're trying to send the email directly from a field in the gallery (ThisItem.RequestingAdmin).
      • You should directly reference the value in the RequestingAdmin field (which should contain the email).

    Steps to Correct Your Email Logic:

    1. Modify the Send Email Button:

      • In your Submit button on the HR screen, modify the logic to send the email directly to ThisItem.RequestingAdmin (if it's a text field containing the email) or to the appropriate value from the gallery.

      Here's how you can update the code:

      Office365Outlook.SendEmailV2(
      ThisItem.RequestingAdmin, // To email address (Hiring Admin's email)
      "Subject of the email",
      "Body of the email"
      )

      This should work if ThisItem.RequestingAdmin contains the email address in text form.

    2. Optional: Using a Variable to Store the Email (if needed):
      If you want to store the email in a variable before sending it, you can use this approach:

      Set(reqAdminEmail, ThisItem.RequestingAdmin); // Store the email in a variable
      Office365Outlook.SendEmailV2(
      reqAdminEmail, // To email address (stored in variable)
      "Subject of the email",
      "Body of the email"
      )
    3. Check for Data Type Compatibility:

      • RequestingAdmin column should be of Text type (or the field where the Hiring Admin's email is saved). If it's a Person/Group column, you'll need to access the .Email property:
        Office365Outlook.SendEmailV2(
        ThisItem.RequestingAdmin.Email, // Correct way to access email in a Person/Group column
        "Subject of the email",
        "Body of the email"
        )
    4. Testing the Email Flow:

      • Test the app by going through the full flow (from submitting a request to HR updating it and sending the email). Check the emails sent to both HR and the Hiring Admin to ensure that the correct recipient is receiving the email at each step.
  • WarrenBelz Profile Picture
    152,855 Most Valuable Professional on at
    If I am reading this correctly, you should need
    ThisItem.'Created By'.Email
    or am I oversimplifying this ?
     
    Please click Does this answer your question if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it a Like.
    MVP (Business Applications)    Visit my blog Practical Power Apps    LinkedIn    Buy me a coffee
  • WarrenBelz Profile Picture
    152,855 Most Valuable Professional on at
     
    A quick follow-up to see if you received the answer you were looking for or if you need further assistance.

    Please click Does this answer your question if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it a Like.
    MVP (Business Applications)    Visit my blog Practical Power Apps    LinkedIn   
  • CU27121403-0 Profile Picture
    4 on at
    Hi WarrenBelz, ThisItem.'Created By'.Email was the syntax I meant to use in my #2 solution in the original post, I was just quick to type out what I had been staring at for days and I forgot to include the '.Email' at the end. What you and Vasanth both wrote were all part of the solutions I had tried and kept receiving this error: "Office365Outlook.SendEmailV2 failed: The function 'SendEmailV2' has an invalid value for parameter 'To' - a blank value was passed to it where it was not expected. Please make sure that a valid argument is passed to the function."
     
    In any case, what I ended up doing is making a copy of my app and re-writing the email section from scratch, using this:
     
    inputTo = ThisItem.'Created by'.Email
     
        Set(reqAdminHR,inputTo.Text);
            Office365Outlook.SendEmailV2(
            reqAdminHR, // To
     
    So far, it's been testing properly within my department. I will be having HR test it this afternoon.
     
  • CU27121403-0 Profile Picture
    4 on at
    The email is generating for the HR screen, but is still not working for the Approve/Review screen, even though I am using the exact same structure as the HR screen.
     
    The Approve/Review screen consists of a gallery that pulls a summary list of all existing items with the status of HRProcessed or Amended, meaning the request has gone through the HR screen and/or has been amended by the Hiring Admin and still needs final approval. There is a view form that displays all fields for whichever item is selected in the gallery. The form has a button to switch to edit mode, HR can make changes to the item and save or open in a new window and view all attachments, etc.
     
     
    The approve button timestamps the user and time (AdminApproval) and updates the Process column. inputReview.Text = ThisItem.'Created by'.Email and is in the gallery section. This displays the Hiring Admin email correctly.
    Patch('Request to Post Vacancy',GalReview.Selected,Defaults('Request to Post Vacancy'),
               {
                AdminApproval:LabelApprove.Text,
                Process:"AdminApproved"
               }
    );
     
     If(
         // check if there were any errors when the test score was submitted
         !IsEmpty(Errors('Request to Post Vacancy')),
         // if true, show any error message
         Notify(
             Concat(Errors('Request to Post Vacancy'), Column&": "&Message),
             NotificationType.Error
         ),
    Set(requestApprove,inputReview.Text);
     
            Office365Outlook.SendEmailV2(
           requestApprove,
        "Request to Post Vacancy - APPROVED SCREEN",
        "Hiring Admin Approved! :<br/><br/><a href=" & Char(34) & "https://sharepoint.com/sites/HR/SitePages/RequesttoPost.aspx" & Char(34) & " target=" & Char(34) & "_blank" & Char(34) & ">Request to Post Vacancy</a>
        <br/><br/>View attached PDF with the details for this request.",
        {Cc:"hr@company.org",
         
            Attachments: Table(
                 {
                     Name: "RequestToPostVacancy.pdf",
                     ContentBytes: PDF(FormReview)
                 }
             )
        }
     
     );
     
           Navigate(NavigationMenu);
     )
  • Verified answer
    WarrenBelz Profile Picture
    152,855 Most Valuable Professional on at
    Firstly, please @tag me in your responses as I am not currently getting Notifications otherwise (I did notsee this one), Firstly, try this
    Patch(
       'Request to Post Vacancy',
       Defaults('Request to Post Vacancy'),
       {
          AdminApproval: GalReview.Selected.LabelApprove.Text,
          Process: "AdminApproved"
       }
    );
    If(
       !IsEmpty(Errors('Request to Post Vacancy')),
       Notify(
          Concat(Errors('Request to Post Vacancy'), Column & ": " & Message),
          NotificationType.Error
       ),
       Office365Outlook.SendEmailV2(
          inputReview.Text,
          "Request to Post Vacancy - APPROVED SCREEN",
          "Hiring Admin Approved! : <br/><br/><a href=" & Char(34) & 
          "https://sharepoint.com/sites/HR/SitePages/RequesttoPost.aspx" & Char(34) & " target=" & Char(34) & "_blank" & Char(34) & ">Request to Post Vacancy</a>
          <br/><br/>View attached PDF with the details for this request.",
          {
             Cc:"hr@company.org",
             Attachments:
             {
                Name: "RequestToPostVacancy.pdf",
                ContentBytes: PDF(FormReview)
             }
          }
       );
       Navigate(NavigationMenu);
    )

    Please click Does this answer your question if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it a Like.
    MVP (Business Applications)    Visit my blog Practical Power Apps    LinkedIn    Buy me a coffee

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 757 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 322 Super User 2025 Season 2

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 209 Super User 2025 Season 2

Last 30 days Overall leaderboard