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 / Attachments not coming...
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

Categories:
I have the same question (0)
  • WarrenBelz Profile Picture
    156,117 Most Valuable Professional on at

    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

  • Dave-ITMan Profile Picture
    on at

    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

  • Verified answer
    WarrenBelz Profile Picture
    156,117 Most Valuable Professional on at

    @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

    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

  • WarrenBelz Profile Picture
    156,117 Most Valuable Professional on at

    @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

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

#2
11manish Profile Picture

11manish 168

#3
sannavajjala87 Profile Picture

sannavajjala87 75 Super User 2026 Season 1

Last 30 days Overall leaderboard