Power Community

Power Community

Streamlining Invoice Management: Sending Emails with Office365 Outlook and Updating Attachments in SharePoint Lists

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.

Prerequisites:

  1. Power Apps Environment: Familiarize yourself with Power Apps for crafting dynamic invoices directly on the screen or using HTML text controls.

SebS_4-1717862247259.png

  2. SharePoint List: Set up a SharePoint List with appropriate columns to capture invoice details, including attachments.

Step-by-Step Integration:

1. Form Control Setup:

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.

2. Attachments Configuration:

  • Introduce an attachment variable in the Items property of the attachments data card (DataCardValue generated for attachment). Let’s name it varAttachment.

3. Submission Logic (Button):

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)

4. SharePoint List Update:

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.

Visual References:

To provide clarity and guidance, include visual references:

  1. SharePoint List Screenshots: Before and after screenshots showcasing records with attachments.

    SebS_0-1717862085875.png

    SebS_1-1717862116566.png

  2. Submission Process GIF: A GIF demonstrating the submission process.

    SebS_5-1717862523337.gif

  3. Email with Invoice: A screenshot of the email received by the recipient with the attached PDF invoice.

    SebS_3-1717862198419.png

Conclusion:

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.

This post was originally published on this site

- Advertisement -spot_img

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisement - Advertisement

Latest News

Create Brand Profiles in Customer Insights – Journeys to Create Cohesive Brand Experiences

In this blog, we will learn about one of the new features introduced by Microsoft in Dynamics 365 in...

More Articles Like This

- Advertisement -spot_img