Hi Experts,
I've been using an app for a while that i've created and suddenly it's coming up with the attached error message, below is the submit code that I have, the patch part is working fine, it's just the email that isn't coming through and neither are the attachments. Any help greatly appreciated.
ClearCollect(
colImages,
AddColumns(
RenameColumns(
'AttachmentControl-1'.Attachments,
"Value",
"ContentBytes"
),
"@odata.type",
""
),
{
Name: "Signature.jpg",
ContentBytes: 'Signature-1'.Image
}
);
Office365Outlook.SendEmailV2("firstname.lastname@domainName.com;user2@domainname.com" , 'Result-Job-Number'.Text , "Hi,<br><br>
Please see completed form below and attached photos<br><br>
<a href=https://domainName.sharepoint.com/sites/PowerApps/Lists/ListName/AllItems.aspx>Click Here to View the Full SharePoint List</a><br><br>
<b>Classification: </b>"&'Dropdown-Classification'.Selected.Value&"<br>
<b>Date Identified: </b>"&'Date-Created'.SelectedDate&"<br>
<b>Status: </b>"&'Dropdown-Status'.Selected.Value&"<br>
<b>Date Closed: </b>"&'Date-Closed'.SelectedDate&"<br>
<b>Time Identified: </b>"&'Result-TimeIdentified'&"<br><br>
<b>Job Number: </b>"&'Job-Number'&"<br>
<b>Business Unit: </b>"&'Dropdown-BusinessUnit'.Selected.Value&"<br>
<b>Originating Department: </b>"&'Dropdown-SourceFunction'.Selected.Result&"<br>
<b>Cause Category: </b>"&'Dropdown-CauseCategory'.Selected.Title&"<br>
<b>Source: </b>"&'Dropdown-Source'.Selected.Value&"<br><br>
<b>Immediate Correction: </b>"&'Txt-ImmediateCorrection'&"<br>
<b>Permanent Preventative Action: </b>"&'Txt-PermanentPreventative'&"<br>
<b>Business Change Required: </b>"&'Dropdown-BusinessChange'.Selected.Value&"<br><br>
<b>Notes: </b>"&'Notes-1'&"<br><br>
<b>Labour Costs: </b>£"&'Result-LabourCosts'&"<br>
<b>Material Costs: </b>£"&'Result-MaterialCosts'&"<br>
<b>Equipment Costs: </b>£"&'Result-EquipmentCosts'&"<br>
<b>Other Costs: </b>£"&'Result-OtherCosts'&"<br>
<b>Total Costs: </b>£"&'Result-TotalCosts'&"<br><br>
<b>Labour Cost Benefit: </b>£"&'Result-LabourCosts_1'&"<br>
<b>Material Cost Benefit: </b>£"&'Result-MaterialCosts_1'&"<br>
<b>Equipment Cost Benefit: </b>£"&'Result-EquipmentCosts_1'&"<br>
<b>Other Cost Benefit: </b>£"&'Result-OtherCosts_1'&"<br>
<b>Total Cost Benefit: </b>£"&'Result-TotalCosts_1'&"<br>
<b>Total Net Benefit: </b>£"&'Result-TotalCosts_2'&"<br><br>
<b>Unique ID: </b>"&'UniqueRefNum-1'&"<br><br>
Regards<br><br>
IT Department<br></br>",
{Attachments: colImages}
);
Patch(ListName, Defaults(ListName),
{
UniqueID: 'UniqueRefNum-1'.Text,
Title: 'ValueDateTimeNow-1'.Text,
Classification: 'Dropdown-Classification'.Selected.Value,
'Date Identified': 'Date-Created'.SelectedDate,
Status: 'Dropdown-Status'.Selected.Value,
'Date Closed': 'Date-Closed'.SelectedDate,
'Time Identified': 'Result-TimeIdentified'.Text,
JobNumber: 'Job-Number'.Text,
'Business Unit': 'Dropdown-BusinessUnit'.Selected.Value,
'Originating Department': 'Dropdown-SourceFunction'.Selected.Result,
'Cause Category': 'Dropdown-CauseCategory'.Selected.Title,
Source: 'Dropdown-Source'.Selected.Value,
'Immediate Correction': 'Txt-ImmediateCorrection'.Text,
'Permanent Preventative Action': 'Txt-PermanentPreventative'.Text,
'Business Change Required': 'Dropdown-BusinessChange'.Selected.Value,
'Labour Costs': 'Final-LabourCosts'.Text,
'Material Costs': 'Final-MaterialCosts'.Text,
'Equipment Costs': 'Final-EquipmentCosts'.Text,
'Other Costs': 'Final-OtherCosts'.Text,
'Total Costs': 'Final-TotalCosts'.Text,
'Labour Cost Benefit': 'Final-LabourCostBenefit'.Text,
'Material Cost Benefit': 'Final-MaterialCostBenefit'.Text,
'Equipment Cost Benefit': 'Final-EquipmentCostBenefit'.Text,
'Other Cost Benefit': 'Final-OtherCostBenefit'.Text,
'Total Cost Benefit': 'Final-TotalCostBenefit'.Text,
'Total Net Benefit': 'Final-TotalNetBenefit'.Text,
Notes: 'Notes-1'.Text
});
Navigate(Screen4,Cover)
Hi @Dave-ITMan ,
Get rid of the one OnStart - the item at the top of your code should do the job as long as you have a valid image in the signature and at least one attachment in the control. I tested the exact code here and received emails with the correct content.
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.
Visit my blog Practical Power Apps
Hi @WarrenBelz ,
I've looked into this and the issue was that on the App > OnStart, I had ClearCollect (colImages, 'AttachmentControl-1'.Attachments) while testing something with the camera feature. I think rather than trying to add the pictures taken from the camera to the collection that I already have (colImages) then i'm best off creating a new collection and adding those to the email separately, can you advise how I could add another one in addition to my large code in the original post please?
Thank you for your help... as always 🙂
Hi @Dave-ITMan ,
The error is invalid attachments - so this
ClearCollect(
colImages,
AddColumns(
RenameColumns(
'AttachmentControl-1'.Attachments,
"Value",
"ContentBytes"
),
"@odata.type",
""
),
{
Name: "Signature.jpg",
ContentBytes: 'Signature-1'.Image
}
);
is not collecting valid data on one or more of the items. Have you ensured the signature has a valid image and also had a look at your collection to see what is in there?
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.
Visit my blog Practical Power Apps
WarrenBelz
146,645
Most Valuable Professional
RandyHayes
76,287
Super User 2024 Season 1
Pstork1
65,997
Most Valuable Professional