Introduction:
Streamlining invoice management within your Microsoft ecosystem can significantly enhance efficiency and accuracy in your record-keeping process. This comprehensive guide'll walk you through the steps to seamlessly send emails using Office365 Outlook with a PDF attachment while updating this attachment to a SharePoint List. We'll leverage Power Apps for dynamic invoice creation to achieve this integration. If you're new to crafting dynamic invoices within Power Apps, refer to a detailed guide I've prepared on How to Create a Dynamic Invoice in Power Apps Using String Interpolation and Mimicking CSS here.
Power Apps Environment: Familiarize yourself with Power Apps for crafting dynamic invoices directly on the screen or using HTML text controls.
2. SharePoint List: Set up a SharePoint List with appropriate columns to capture invoice details, including attachments.
Begin by setting up a Form control in Edit mode to edit existing records or incorporate it into your screen to create new records. You can remove all fields and leave only the attachment field, as it can be hidden from the user later.
In the Items property, handle a lookup for the right record or a Lookup for the ID of a specific record, just for this example.
varAttachment
.
Handle the submission process using Power Apps functions:
Important:
You can't directly place the generated PDF from the PDF Function in Attachment Control. Attachment Control requires a specific Schema displayed in the code below.
Note that the DisplayName and ID can be dynamic, but I will not implement this in this example.
//this part creates PDF using PDF Function from HtmlText1_2 Control, but You can change it to
//Screen or your container
Set(
varPDF,
PDF(HtmlText1_2)
);
//Variable is created
Set(
varAttachment,
{
DisplayName: "TestInvoice.pdf",
Id: "TestInvoice.pdf",
Value: Substitute(
JSON(
varPDF,
JSONFormat.IncludeBinaryData
),
"""",
""
)
}
);
// email handling
Office365Outlook.SendEmailV2(
"recipient@example.com", // Recipient's email
"Test 001", // Subject of the email
"Testing something new", // Body of the email
{
Attachments: Table({
Name: varAttachment.DisplayName,
ContentBytes: varPDF
})
}
);
SubmitForm(Form1);
ResetForm(Form1);
Notify("Email sent successfully. Record updated with Invoice Completed.",NotificationType.Success)
Upon submission, the attachment will be simultaneously updated in the SharePoint List along with sending the email. Verify the updated record in your SharePoint List to ensure successful integration.
To provide clarity and guidance, include visual references:
SharePoint List Screenshots: Before and after screenshots showcasing records with attachments.
Submission Process GIF: A GIF demonstrating the submission process.
Email with Invoice: A screenshot of the email received by the recipient with the attached PDF invoice.
By following these step-by-step instructions and visual references, you can seamlessly integrate Office365 Outlook, Power Apps, and SharePoint for efficient invoice management. Enhance your workflow today and ensure accuracy in your invoicing process.