Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Apps - Building Power Apps
Answered

Attachments not coming through via email in OnSuccess of Form

(0) ShareShare
ReportReport
Posted on by

Hi Experts,

 

I have the below code in my OnSuccess of a form but it isn't CC'ing the Created By.email and it isn't attaching the attachments in the email but it is in my sharepoint list, can you please advise what I need to change? 

 

 

If(
Form2ChangeType.Text = "Product",
Office365Outlook.SendEmailV2( EmailListNew, "Product Change Request - Approval Required", 
"Hi,<br><br>

A Product Change Request requires your initial approval. Once approved, the Change Request group email will be notified and waiting for other departments to approve before any changes are made.
<a href=https://linktoapp.com>Please click this link to Agree or Disagree.</a><br><br>

<b>ID: </b>"& Form2.LastSubmit.ID&"<br>
<b>Change Type: </b>" & Form2.LastSubmit.'Change Type'.Value&"<br>
<b>Title: </b>" & Form2.LastSubmit.Title&"<br>
<b>Part Number: </b>" &Form2.LastSubmit.'Part Number'&"<br>
<b>Description of Change: </b>" & Substitute(Form2.LastSubmit.'Description of Change', Char(10), "<br>") &"<br>
<b>Reason for Change: </b>" & Substitute(Form2.LastSubmit.'Reason for Change', Char(10), "<br>") &"<br>
<b>Implemented by Date: </b>" & Form2.LastSubmit.'Implemented By Date'&"<br>
<b>Support: </b>" & Form2SupportText&"<br><br>

Regards<br><br>

Company Name<br></br>",
 {Cc: Form2.LastSubmit.'Created By'.Email};
 {
 Attachments: RenameColumns(
 AttachFiles.Attachments,
 "Value",
 "ContentBytes"
 ),
 Importance: "Normal"
 }
),

Form2ChangeType.Text = "Production",
Office365Outlook.SendEmailV2( EmailListNew, "Production Change Request - Approval Required", 
"Hi,<br><br>

A Production Change Request requires your initial approval. Once approved, the Change Request group email will be notified and waiting for other departments to approve before any changes are made.
<a href=https://linktoapp.com>Please click this link to Agree or Disagree.</a><br><br>

<b>ID: </b>"& Form2.LastSubmit.ID&"<br>
<b>Change Type: </b>" & Form2.LastSubmit.'Change Type'.Value&"<br>
<b>Title: </b>" & Form2.LastSubmit.Title&"<br>
<b>Description of Change: </b>" & Substitute(Form2.LastSubmit.'Description of Change', Char(10), "<br>") &"<br>
<b>Reason for Change: </b>" & Substitute(Form2.LastSubmit.'Reason for Change', Char(10), "<br>") &"<br>
<b>Implemented by Date: </b>" & Form2.LastSubmit.'Implemented By Date'&"<br>
<b>Support: </b>" & Form2SupportText&"<br><br>

Regards<br><br>

Company Name<br></br>",
 {Cc: Form2.LastSubmit.'Created By'.Email};
 {
 Attachments: RenameColumns(
 AttachFiles.Attachments,
 "Value",
 "ContentBytes"
 ),
 Importance: "Normal"
 }
),

Form2ChangeType.Text = "CPQ / System",
Office365Outlook.SendEmailV2( EmailListNew, "CPQ / System Change Request - Approval Required", 
"Hi,<br><br>

A CPQ / System Change Request requires your initial approval. Once approved, the Change Request group email will be notified and waiting for other departments to approve before any changes are made.
<a href=https://linktoapp.com>Please click this link to Agree or Disagree.</a><br><br>

<b>ID: </b>"& Form2.LastSubmit.ID&"<br>
<b>Change Type: </b>" & Form2.LastSubmit.'Change Type'.Value&"<br>
<b>Title: </b>" & Form2.LastSubmit.Title&"<br>
<b>Description of Change: </b>" & Substitute(Form2.LastSubmit.'Description of Change', Char(10), "<br>") &"<br>
<b>Reason for Change: </b>" & Substitute(Form2.LastSubmit.'Reason for Change', Char(10), "<br>") &"<br>
<b>Implemented by Date: </b>" & Form2.LastSubmit.'Implemented By Date'&"<br>
<b>Support: </b>" & Form2SupportText&"<br><br>

Regards<br><br>

Company Name<br></br>",
 {Cc: Form2.LastSubmit.'Created By'.Email};
 {
 Attachments: RenameColumns(
 AttachFiles.Attachments,
 "Value",
 "ContentBytes"
 ),
 Importance: "Normal"
 }
))
;

Navigate(Home)

 

 

Thanks in advance

 

Dave

  • WarrenBelz Profile Picture
    146,708 Most Valuable Professional on at
    Re: Attachments not coming through via email in OnSuccess of Form

    @Dave-ITMan ,

    You could try setting a Variable to AttachFiles.Attachments before you submit and then run against this OnSuccess.

     

    Please click Accept as solution 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 Thumbs Up.

    MVP (Business Applications)   Visit my blog Practical Power Apps

  • Dave-ITMan Profile Picture
    on at
    Re: Attachments not coming through via email in OnSuccess of Form

    Hi @WarrenBelz ,

    Ah I see, thank you for advising, I have put the OnSuccess code into my Submit button and that has now worked. 

     

    The problem that I have now though, in the email body it's referencing Form2.LastSubmit for various fields, what's my best way of getting this displayed, just in text boxes on another screen?

     

    Regards

    Dave

  • Verified answer
    WarrenBelz Profile Picture
    146,708 Most Valuable Professional on at
    Re: Attachments not coming through via email in OnSuccess of Form

    @Dave-ITMan ,

    OK - I see the issue - you cannot do that OnSuccess as the attachment control content will no longer be available - you have to send the mail before the form is submitted.

     

    Please click Accept as solution 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 Thumbs Up.

    MVP (Business Applications)   Visit my blog Practical Power Apps

  • Dave-ITMan Profile Picture
    on at
    Re: Attachments not coming through via email in OnSuccess of Form

    Hi @WarrenBelz ,

    Thanks for this, i'm now getting the CC'd user but images still not coming through to email but is going in to sharepoint list? 

    Regards

    Dave

  • WarrenBelz Profile Picture
    146,708 Most Valuable Professional on at
    Re: Attachments not coming through via email in OnSuccess of Form

    Hi @Dave-ITMan ,

    Try this format

    {
     Cc: Form2.LastSubmit.'Created By'.Email,
     Attachments: 
     AddColumns(
     RenameColumns(
     AttachFiles.Attachments,
     "Value",
     "ContentBytes"
     ),
     "'@odata.Type'",
     ""
     )
    }

     

    Please click Accept as solution 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 Thumbs Up.

    MVP (Business Applications)   Visit my blog Practical Power Apps

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

Understanding Microsoft Agents - Introductory Session

Confused about how agents work across the Microsoft ecosystem? Register today!

Markus Franz – Community Spotlight

We are honored to recognize Markus Franz as our April 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,708 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 66,030 Most Valuable Professional

Leaderboard