Process invoices with data capture

Important

Some or all of this functionality is available as part of a preview release. The content and the functionality are subject to change.

Important

Before enabling this solution in your environment, ensure that you have an active Power Automate trial or license with Dataverse capacity.

Data capture helps you to train and use optical character recognition (OCR) models for processing and ingesting scope 2 purchased energy invoices. Data capture uses Microsoft Power Platform's AI Builder and document intelligence solutions.

Train a model with AI Builder

To train an invoice processing model in AI Builder, follow these steps:

  1. Sign in to Power Apps or Power Automate.

  2. Select AI models on the left navigation and initiate a trial by starting with step 3 of Activate an AI Builder trial license. You'll need to wait for your database to finish building before continuing on to the next step.

    Note

    If you've already used AI Builder and have exhausted the trial period, you'll need to either extend your AI Builder trial or purchase additional credits to use this feature. For more information about AI Builder licenses, go to AI Builder paid licenses FAQ.

  3. Copy the following link and replace {environment_Id} with your environment's ID:

    https://make.powerapps.com/environment/{environment_Id}/aibuilder/createModel?templateName=DocumentScanning&modelNameSeed=Purchased%20Energy%20AI%20Builder%20Model&context.fields=Quantity,Quantity%20Unit,Consumption%20Start%20Date,Consumption%20End%20Date
    

    Note

    To find your environment ID, go to the Environments tab in the Power Platform admin center and select your current environment.

  4. Open the link. A new Extract custom information from documents AI Builder model initiates for you with the necessary purchased energy fields.

  5. On the Select the type of documents your model will process page, select Structured documents, and then select Next.

  6. On the Choose information to extract page, the following required fields are prepopulated for you:

    • Quantity
    • Quantity Unit
    • Consumption Start Date
    • Consumption End Date

    Important

    Don't remove or modify any of the pre-populated fields.

    Select Next.

  7. On the Add collections of documents page, select New collection. We recommend that you use one collection per purchased energy provider for best results.

    Note

    You can rename collections to reflect the content they represent.

  8. Upload at least five invoices with the same structure to the collection, and then select Next.

  9. Tag the required fields for each document. Select the document in the collect, select a field in the document, and then select the field.

    Screenshot of training AI Builder model.

    Tag all fields in the invoice, select the next document, and continue until you tag the fields in all documents in the collection. Select Next.

  10. Repeat steps 4-9 for all other collections.

  11. Select Next to review your model. On the Model summary page, select Train. After training completes, select Go to models to view the overall accuracy score and other details related to training success.

  12. (Optional): To verify the accuracy score, perform a test run with an invoice of the same structure and provider.

Important

If the structure of an invoice type for which you've trained a model for changes, you must update the relevant collection by uploading at least one invoice that contains the new structure.

Configure the data capture solution

  1. In Power Apps, select Solutions in the left navigation and then search for and select the Microsoft Sustainability Manager Data Capture solution.

  2. Go to Cloud flows and turn on the following flows, in this order:

    • Emit data capture notification
    • PE Invoice Enrichment Step
    • PE Invoice pipeline
    • Create PE record from approved invoice
  3. In the Objects panel on the left, select Step field definition.

  4. Open each of the following step field definitions and validate that the External name matches the Display name:

    • Consumption Start Date
    • Consumption End Date
    • Quantity
    • Quantity Unit
  5. In the Objects panel on the left, select Pipeline step definition.

  6. Select Purchased Energy Invoice Extraction and wait to be redirected to Microsoft Sustainability Manager.

  7. Select your AI Builder model from the dropdown in the AI Builder model field and save.

    Note

    You can also change the failure and success thresholds in this step.

    Screenshot of AI Builder Model configuration step.

  8. Return to Power Apps and select Done to complete the process.

Support custom dates

If a document type that is used to train the model has a date format that Dataverse doesn't support by default, you can customize a data capture flow to support it:

  1. In Power Apps, select Flows from the side navigation pane.

  2. Select the Format invoice date workflow.

  3. Add a new option in the conditional statement for the name of the collection that has documents with nonsupported date formats.

  4. Add an action to parse the date string to a supported format.

    Screenshot of adding a custom date to the Format invoice date flow.

Upload and process an invoice

After you configure your AI Builder model, you can begin using it to upload purchased energy invoices within Microsoft Sustainability Manager.

  1. In the Data area of the left navigation, select Data capture (preview).

  2. Select Add document request.

  3. On the Document Intelligence Form page, enter information for the following required fields, and then select Save and Close.

    • Invoice name
    • Organizational unit
    • Facility
    • Energy provider name
    • Energy type
    • AI Builder model

    Note

    Optionally, you can include an Invoice description.

    Screenshot of data capture document request form.

    The new request displays as a tile under Action required.

  4. Select Upload, and then select an invoice to upload.

    After it uploads, the invoice will be sent to AI Builder for field extraction. This process takes a few moments.

  5. Select Review. Select the Extracted details tab to review the extracted fields and verify the fields entered in step 3.

  6. Based on extraction accuracy, select Approve or Reject.

    The invoice completes ingestion and goes into the appropriate scope 2 category as purchased energy data.

  7. (Optional): If you rejected an invoice, you can select Reupload to upload it again, or you can select the ellipses (...) and then select Remove request to remove the request.

  8. Repeat steps 1-6 for all further invoices.