web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id : opbj8IekJWndxpoKG+bMV1
Power Apps - Building Power Apps
Answered

Attachments not coming through via email in OnSuccess of Form

Like (0) ShareShare
ReportReport
Posted on 28 Jul 2023 11:14:28 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
    148,894 Most Valuable Professional on 01 Aug 2023 at 12:12:39
    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 01 Aug 2023 at 11:38:17
    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
    148,894 Most Valuable Professional on 01 Aug 2023 at 10:37:13
    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 01 Aug 2023 at 09:15:08
    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
    148,894 Most Valuable Professional on 28 Jul 2023 at 21:45:02
    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

Announcing our 2025 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for…

Paul Stork – Community Spotlight

We are honored to recognize Paul Stork as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 791 Most Valuable Professional

#2
MS.Ragavendar Profile Picture

MS.Ragavendar 410 Super User 2025 Season 2

#3
mmbr1606 Profile Picture

mmbr1606 275 Super User 2025 Season 2

Loading complete