Create a Document Intelligence Logic Apps workflow

This content applies to:checkmark v4.0 (preview) | Previous versions: blue-checkmark v3.1 (GA) blue-checkmark v3.0 (GA)

This content applies to: checkmark v2.1 | Latest version: blue-checkmark v4.0 (preview)

Important

This tutorial and the Logic App Document intelligence connector targets Document intelligence REST API v3.0 and forward.

Important

This tutorial and the Logic App Document intelligence connector targets Document intelligence REST API v2.1 and must be used with the FOTT Sample Labeling tool.

Azure Logic Apps is a cloud-based platform that can be used to automate workflows without writing a single line of code. The platform enables you to easily integrate Microsoft and your applications with your apps, data, services, and systems. A Logic App is the Azure resource you create when you want to develop a workflow. Here are a few examples of what you can do with a Logic App:

  • Create business processes and workflows visually.
  • Integrate workflows with software as a service (SaaS) and enterprise applications.
  • Automate enterprise application integration (EAI), business-to-business (B2B), and electronic data interchange (EDI) tasks.

For more information, see Logic Apps Overview.

In this tutorial, we show you how to build a Logic App connector flow to automate the following tasks:

  • Detect when an invoice as been added to a OneDrive folder.
  • Process the invoice using the Document Intelligence prebuilt-invoice model.
  • Send the extracted information from the invoice to a pre-specified email address.

Choose a workflow using a file from either your Microsoft OneDrive account or Microsoft ShareDrive site:

Prerequisites

To complete this tutorial, you need the following resources:

  • An Azure subscription. You can create a free Azure subscription

  • A free OneDrive or OneDrive for Business cloud storage account.

    Note

    • OneDrive is intended for personal storage.
    • OneDrive for Business is part of Office 365 and is designed for organizations. It provides cloud storage where you can store, share, and sync all work files.
  • A free Outlook online or Office 365 email account**.

  • A sample invoice to test your Logic App. You can download and use our sample invoice document for this tutorial.

  • A Document Intelligence resource. Once you have your Azure subscription, create a Document Intelligence resource in the Azure portal to get your key and endpoint. If you have an existing Document Intelligence resource, navigate directly to your resource page. You can use the free pricing tier (F0) to try the service, and upgrade later to a paid tier for production.

    • After the resource deploys, select Go to resource. Copy the Keys and Endpoint values from your resource in the Azure portal and paste them in a convenient location, such as Microsoft Notepad. You need the key and endpoint values to connect your application to the Document Intelligence API. For more information, see create a Document Intelligence resource.

      Screenshot showing how to access resource key and endpoint URL.

Create a OneDrive folder

Before we jump into creating the Logic App, we have to set up a OneDrive folder.

  1. Sign in to your OneDrive or OneDrive for Business home page.

  2. Select the ➕ Add New button in the upper-left corner sidebar and select Folder.

    Screenshot of add-new button.

  3. Enter a name for your new folder and select Create.

    Screenshot of create and name folder window.

  4. You see the new folder in your files.

    Screenshot of the new folder.

  5. We're done with OneDrive for now.

Create a Logic App resource

At this point, you should have a Document Intelligence resource and a OneDrive folder all set. Now, it's time to create a Logic App resource.

  1. Navigate to the Azure portal.

  2. Select ➕ Create a resource from the Azure home page.

    Screenshot of create a resource in the Azure portal.

  3. Search for and choose Logic App from the search bar.

  4. Select the create button

    Screenshot of the Create Logic App page.

  5. Next, you're going to fill out the Create Logic App fields with the following values:

    • Subscription. Select your current subscription.
    • Resource group. The Azure resource group that contains your resource. Choose the same resource group you have for your Document Intelligence resource.
    • Type. Select Consumption. The Consumption resource type runs in global, multi-tenant Azure Logic Apps and uses the Consumption billing model.
    • Logic App name. Enter a name for your resource. We recommend using a descriptive name, for example YourNameLogicApp.
    • Publish. Select Workflow.
    • Region. Select your local region.
    • Enable log analytics. For this project, select No.
    • Plan Type. Select Consumption. The Consumption resource type runs in global, multi-tenant Azure Logic Apps and uses the Consumption billing model.
    • Zone Redundancy. Select disabled.
  6. When you're done, you have something similar to the following image (Resource group, Logic App name, and Region may be different). After checking these values, select Review + create in the bottom-left corner.

    Screenshot showing field values to create a Logic App resource.

  7. A short validation check runs. After it completes successfully, select Create in the bottom-left corner.

  8. Next, you're redirected to a screen that says Deployment in progress. Give Azure some time to deploy; it can take a few minutes. After the deployment is complete, you see a banner that says, Your deployment is complete. When you reach this screen, select Go to resource.

  9. Finally, you're redirected to the Logic Apps Designer page. There's a short video for a quick introduction to Logic Apps available on the home screen. When you're ready to begin designing your Logic App, select the Blank Logic App button from the Templates section.

    Screenshot showing how to enter the Logic App Designer.

  10. You see a screen that looks similar to the following image. Now, you're ready to start designing and implementing your Logic App.

    Screenshot of the Logic App Designer start page.

Create an automation flow

Now that you have the Logic App connector resource set up and configured, let's create the automation flow and test it out!

  1. Search for and select OneDrive or OneDrive for Business in the search bar. Then, select the When a file is created trigger.

    Screenshot of the OneDrive connector and trigger selection page.

  2. Next, a pop-up window appears, prompting you to log into your OneDrive account. Select Sign in and follow the prompts to connect your account.

    Tip

    If you try to sign into the OneDrive connector using an Office 365 account, you may receive the following error: Sorry, we can't sign you in here with your @MICROSOFT.COM account.

    • This error happens because OneDrive is a cloud-based storage for personal use that can be accessed with an Outlook.com or Microsoft Live account not with Office 365 account.
    • You can use the OneDrive for Business connector if you want to use an Office 365 account. Make sure that you have created a OneDrive Folder for this project in your OneDrive for Business account.
  3. After your account is connected, select the folder you created earlier in your OneDrive or OneDrive for Business account. Leave the other default values in place.

    Screenshot of the When a file is created window.

  1. Next, we're going to add a new step to the workflow. Select the ➕ New step button underneath the newly created OneDrive node.

    Screenshot of the OneDrive trigger setup.

  2. A new node is added to the Logic App designer view. Search for Form Recognizer (Document Intelligence forthcoming) in the Choose an operation search bar and select Analyze Document for Prebuilt or Custom models (v3.0 API) from the list.

    Screenshot of the Analyze Document for Prebuilt or Custom models (v3.0 API) selection button.

  3. Now, you see a window to create your connection. Specifically, you're going to connect your Document Intelligence resource to the Logic Apps Designer Studio:

    • Enter a Connection name. It should be something easy to remember.

    • Enter the Document Intelligence resource Endpoint URL and Account Key that you copied previously. If you skipped this step earlier or lost the strings, you can navigate back to your Document Intelligence resource and copy them again. When you're done, select Create.

      Screenshot of the logic app connector dialog window

    Note

    If you already logged in with your credentials, the prior step is skipped.

  4. Next, you see the selection parameters window for the Analyze Document for Prebuilt or Custom Models (v3.0 API) connector.

    Screenshot of the prebuilt model selection window.

  5. Complete the fields as follows:

    • Model Identifier. Specify which model you want to call, in this case we're calling the prebuilt invoice model, so enter prebuilt-invoice.

    • Document/Image File Content. Select this field. A dynamic content pop-up appears. If it doesn't, select the Add dynamic content button below the field and choose File content. This step is essentially sending the file(s) to be analyzed to the Document Intelligence prebuilt-invoice model. Once you see the File content badge show in the Document /Image file content field, you've completed this step correctly.

    • Document/Image URL. Skip this field for this project because we're already pointing to the file content directly from the OneDrive folder.

    • Add new parameter. Skip this field for this project.

      Screenshot of add file content window.

  6. We need to add a few more steps. Once again, select the ➕ New step button to add another action.

  7. In the Choose an operation search bar, enter Control and select the Control tile.

    Screenshot of the control tile from the Choose an Operation menu.

  8. Scroll down and select the For each Control tile from the Control list.

    Screenshot of the For Each Control tile from the Control menu.

  9. In the For each step window, there's a field labeled Select an output from previous steps. Select this field. A dynamic content pop-up appears. If it doesn't, select the Add dynamic content button below the field and choose documents.

    Screenshot of the dynamic content list.

  10. Now, select Add an Action from within the For each step window.

  11. In the Choose an operation search bar, enter Outlook and select Outlook.com (personal) or Office 365 Outlook (work).

  12. In the actions list, scroll down until you find Send an email (V2) and select this action.

    Screenshot of Send an email (V2) action button.

  13. Just like with OneDrive, you're asked to sign into your Outlook or Office 365 Outlook account. After you sign in, you see a window where we're going to format the email with dynamic content that Document Intelligence extracts from the invoice.

  14. We're going to use the following expression to complete some of the fields:

    
      items('For_each')?['fields']?['FIELD-NAME']?['content']
    
  15. In order to access a specific field, we select the add the dynamic content button and select the Expression tab.

    Screenshot of the expression function field.

  16. In the ƒx box, copy and paste the above formula and replace FIELD-NAME with the name of the field we want to extract. For the full list of available fields, refer to the concept page for the given API. In this case, we use the prebuilt-invoice model field extraction values.

  17. We're almost done! Make the following changes to the following fields:

    • To. Enter your personal or business email address or any other email address you have access to.

    • Subject. Enter Invoice received from: and then add the following expression:

      
        items('For_each')?['fields']?['VendorName']?['content']
      
    • Body. We're going to add specific information about the invoice:

      • Type Invoice ID: and, using the same method as before, append the following expression:

        
        items('For_each')?['fields']?['InvoiceId']?['content']
        
      • On a new line type Invoice due date: and append the following expression:

        
          items('For_each')?['fields']?['DueDate']?['content']
        
      • Type Amount due: and append the following expression:

        
          items('For_each')?['fields']?['AmountDue']?['content']
        
      • Lastly, because the amount due is an important number, we also want to send the confidence score for this extraction in the email. To do this type Amount due (confidence): and append the following expression:

        
          items('For_each')?['fields']?['AmountDue']?['confidence']
        
    • When you're done, the window looks similar to the following image:

      Screenshot of the Send an email (V2) window with completed fields.

  18. Select Save in the upper left corner.

    Screenshot of the Logic Apps Designer save button.

Note

  • This current version only returns a single invoice per PDF.
  • The "For each loop" is required around the send email action to enable an output format that may return more than one invoice from PDFs in the future.
  1. Next, we're going to add a new step to the workflow. Select the ➕ New step button underneath the newly created OneDrive node.

  2. A new node is added to the Logic App designer view. Search for "Form Recognizer (Document Intelligence forthcoming)" in the Choose an operation search bar and select Analyze Invoice from the list.

    Screenshot of Analyze Invoice action.

  3. Now, you see a window where you can create your connection. Specifically, you're going to connect your Form Recognizer resource to the Logic Apps Designer Studio:

    • Enter a Connection name. It should be something easy to remember.
    • Enter the Form Recognizer resource Endpoint URL and Account Key that you copied previously. If you skipped this step earlier or lost the strings, you can navigate back to your Form Recognizer resource and copy them again. When you're done, select Create.

    Screenshot of the logic app connector dialog window.

    Note

    If you already logged in with your credentials, the prior step is skipped. Continue by completing the Analyze Invoice parameters.

  4. Next, you see the selection parameters window for the Analyze Invoice connector.

    Screenshot showing the analyze invoice window fields.

  5. Complete the fields as follows:

    • Document/Image File Content. Select this field. A dynamic content pop-up appears. If it doesn't, select the Add dynamic content button below the field and choose File content. This step is essentially sending the file(s) to be analyzed to the Document Intelligence prebuilt-invoice model. Once you see the File content badge show in the Document /Image file content field, you've completed this step correctly.
    • Document/Image URL. Skip this field for this project because we're already pointing to the file content directly from the OneDrive folder.
    • Include Text Details. Select Yes.
    • Add new parameter. Skip this field for this project.
  6. We need to add the last step. Once again, select the ➕ New step button to add another action.

  7. In the Choose an operation search bar, enter Outlook and select Outlook.com (personal) or Office 365 Outlook (work).

  8. In the actions list, scroll down until you find Send an email (V2) and select this action.

  9. Sign into your Outlook or Office 365 Outlook account. After doing so, you see a window where we're going to format the email to be sent with dynamic content extracted from the invoice.

    Screenshot of Send an email (V2) action button.

  10. We're almost done! Type the following entries in the fields:

    • To. Enter your personal or business email address or any other email address you have access to.

    • Subject. Enter Invoice received from: and then append dynamic content Vendor name field Vendor name.

    • Body. We're going to add specific information about the invoice:

      • Type Invoice ID: and append the dynamic content Invoice ID field Invoice ID.

      • On a new line type Invoice due date: and append the dynamic content Invoice date field invoice date (date).

      • Type Amount due: and append the dynamic content Amount due field Amount due (number).

      • Lastly, because the amount due is an important number we also want to send the confidence score for this extraction in the email. To do this type Amount due (confidence): and add the dynamic content Amount due field confidence of amount due. When you're done, the window looks similar to the following image.

      Screenshot of the completed Outlook fields.

      Tip

      If you don't see the dynamic content display automatically, use the Search dynamic content bar to find field entries.

  11. Select Save in the upper left corner.

    Screenshot of the Logic Apps Designer save button.

    Note

    • This current version only returns a single invoice per PDF.
    • The "For each loop" around the send email action enables an output format that may return more than one invoice from PDFs in the future.

Prerequisites

To complete this tutorial, you need the following resources:

  • An Azure subscription. You can create a free Azure subscription

  • Access to a SharePoint site.

  • A free Outlook online or Office 365 email account.

  • A sample invoice to test your Logic App. You can download and use our sample invoice document for this tutorial.

  • A Document Intelligence resource. Once you have your Azure subscription, create a Document Intelligence resource in the Azure portal to get your key and endpoint. If you have an existing Document Intelligence resource, navigate directly to your resource page. You can use the free pricing tier (F0) to try the service, and upgrade later to a paid tier for production.

    • After the resource deploys, select Go to resource. Copy the Keys and Endpoint values from your resource in the Azure portal and paste them in a convenient location, such as Microsoft Notepad. You need the key and endpoint values to connect your application to the Document Intelligence API. For more information, see create a Document Intelligence resource.

      Screenshot showing how to access resource key and endpoint URL.

Create a Sharepoint folder

Before we jump into creating the Logic App, we have to set up a Sharepoint folder.

  1. Sign in to your SharePoint site home page.

  2. Select Documents, then the ➕ New button near the upper-left corner of the site window, and choose Folder.

    Screenshot of add-new button.

  3. Enter a name for your new folder and select Create.

    Screenshot of create and name folder window.

  4. Your new folder is located in your site library.

    Screenshot of the newly created folder.

  5. We're done with SharePoint for now.

Create Logic App resource

At this point, you should have a Document Intelligence resource and a SharePoint folder all set. Now, it's time to create a Logic App resource.

  1. Navigate to the Azure portal.

  2. Select ➕ Create a resource from the Azure home page.

    Screenshot of create a resource in the Azure portal.

  3. Search for and choose Logic App from the search bar.

  4. Select the create button

    Screenshot of the Create Logic App page.

  5. Next, you're going to complete the Create Logic App fields with the following values:

    • Subscription. Select your current subscription.
    • Resource group. The Azure resource group that contains your resource. Choose the same resource group you have for your Document Intelligence resource.
    • Type. Select Consumption. The Consumption resource type runs in global, multi-tenant Azure Logic Apps and uses the Consumption billing model.
    • Logic App name. Enter a name for your resource. We recommend using a descriptive name, for example YourNameLogicApp.
    • Publish. Select Workflow.
    • Region. Select your local region.
    • Enable log analytics. For this project, select No.
    • Plan Type. Select Consumption. The Consumption resource type runs in global, multi-tenant Azure Logic Apps and uses the Consumption billing model.
    • Zone Redundancy. Select disabled.
  6. When you're done, you have something similar to the following image (Resource group, Logic App name, and Region may be different). After checking these values, select Review + create in the bottom-left corner.

    Screenshot showing field values to create a Logic App resource.

  7. A short validation check runs. After it completes successfully, select Create in the bottom-left corner.

  8. Next, you're redirected to a screen that says Deployment in progress. Give Azure some time to deploy; it can take a few minutes. After the deployment is complete, you see a banner that says, Your deployment is complete. When you reach this screen, select Go to resource.

  9. Finally, you're redirected to the Logic Apps Designer page. There's a short video for a quick introduction to Logic Apps available on the home screen. When you're ready to begin designing your Logic App, select the Blank Logic App button from the Templates section.

    Screenshot showing how to enter the Logic App Designer.

  10. You see a screen that looks similar to the following image. Now, you're ready to start designing and implementing your Logic App.

    Screenshot of the Logic App Designer start page.

  11. Search for and select SharePoint from the search bar. Then, select the When a file is created (properties only) trigger.

    Screenshot of the SharePoint connector and trigger selection page.

  12. Logic Apps automatically signs you into your SharePoint account(s).

  13. After your account is connected, complete the Site Address and Library Name fields. Select the Add new parameter field and select Folder.

    Screenshot of the When a file is created window with added parameter.

  14. Select the directory path including the folder that you created earlier.

    Screenshot of the added parameter field.

    Tip

    Select the arrow at the end of each listed folder to traverse to the next folder in the path: Screenshot of how to traverse the folder path.

  1. Next, we're going to add another step to the workflow. Select the ➕ New step button underneath the newly created SharePoint node.

  2. Search for and select SharePoint from the search bar once more. Then, select the Get file content action.

  3. Complete the fields as follows:

    • Site Address. Select your SharePoint site.
    • File Identifier. Select this field. A dynamic content pop-up appears. If it doesn't, select the Add dynamic content button below the field and choose Identifier.
    • Infer Content Type. Select Yes.

    Screenshot of the Get File Content node.

  4. We're going to add another new step to the workflow. Select the ➕ New step button underneath the newly created SharePoint node.

  5. A new node is added to the Logic App designer view. Search for Form Recognizer (Document Intelligence forthcoming) in the Choose an operation search bar and select Analyze Document for Prebuilt or Custom models (v3.0 API) from the list.

    Screenshot of the Analyze Document for Prebuilt or Custom models (v3.0 API) selection button.

  6. Now, you see a window where you can create your connection. Specifically, you're going to connect your Document Intelligence resource to the Logic Apps Designer Studio:

    • Enter a Connection name. It should be something easy to remember.

    • Enter the Document Intelligence resource Endpoint URL and Account Key that you copied previously. If you skipped this step earlier or lost the strings, you can navigate back to your Document Intelligence resource and copy them again. When you're done, select Create.

      Screenshot of the logic app connector dialog window

    Note

    If you already logged in with your credentials, the prior step is skipped.

  7. Next, you see the selection parameters window for the Analyze Document for Prebuilt or Custom models (v3.0 API) connector.

    Screenshot of the prebuilt model selection window.

  8. Complete the fields as follows:

    • Model Identifier. Specify which model you want to call, in this case we're calling the prebuilt invoice model, so enter prebuilt-invoice.
    • Document/Image File Content. Select this field. A dynamic content pop-up appears. If it doesn't, select the Add dynamic content button below the field and choose File content. This step is essentially sending the file(s) to be analyzed to the Document Intelligence prebuilt-invoice model. Once you see the File content badge show in the Document /Image file content field, you've completed this step correctly.
    • Document/Image URL. Skip this field for this project because we're already pointing to the file content directly from the OneDrive folder.
    • Add new parameter. Skip this field for this project.
  9. We need to add a few more steps. Once again, select the ➕ New step button to add another action.

  10. Control and select the Control tile.

    Screenshot of the control tile from the Choo. In the **Choose an operation** search bar, enter an Operation menu.

  11. Scroll down and select the For each Control tile from the Control list.

    Screenshot of the For Each Control tile from the Control menu.

  12. In the For each step window, there's a field labeled Select an output from previous steps. Select this field. A dynamic content pop-up appears. If it doesn't, select the Add dynamic content button below the field and choose documents.

    Screenshot of the dynamic content list.

  13. Now, select Add an Action from within the For each step window.

  14. In the Choose an operation search bar, enter Outlook and select Outlook.com (personal) or Office 365 Outlook (work).

  15. In the actions list, scroll down until you find Send an email (V2) and select this action.

    Screenshot of Send an email (V2) action button.

  16. Sign into your Outlook or Office 365 Outlook account. After doing so, you see a window where we're going to format the email with dynamic content that Document Intelligence extracts from the invoice.

  17. We're going to use the following expression to complete some of the fields:

    
      items('For_each')?['fields']?['FIELD-NAME']?['content']
    
  18. In order to access a specific field, we select the add the dynamic content button and select the Expression tab.

    Screenshot of the expression function field.

  19. In the ƒx box, copy and paste the above formula and replace FIELD-NAME with the name of the field we want to extract. For the full list of available fields, refer to the concept page for the given API. In this case, we use the prebuilt-invoice model field extraction values.

  20. We're almost done! Make the following changes to the following fields:

    • To. Enter your personal or business email address or any other email address you have access to.

    • Subject. Enter Invoice received from: and leave your cursor positioned after the colon.

    • Enter the following expression into the Expression field and select OK:

      
        items('For_each')?['fields']?['VendorName']?['content']
      
      • After you enter the expression in the field select the OK button and the formula badge will appear in the place where you left your cursor:

      Screenshot of the formula expression field.

      Screenshot of the formula expression badge.

    • Body. We're going to add specific information about the invoice:

      • Type Invoice ID: and, using the same method as before: position your cursor, copy the following expression into the expression field, and select OK the following expression:

        
        items('For_each')?['fields']?['InvoiceId']?['content']
        
      • On a new line type Invoice due date: and append the following expression:

        
          items('For_each')?['fields']?['DueDate']?['content']
        
      • Type Amount due: and append the following expression:

        
          items('For_each')?['fields']?['AmountDue']?['content']
        
      • Lastly, because the amount due is an important number, we also want to send the confidence score for this extraction in the email. To do this type Amount due (confidence): and append the following expression:

        
          items('For_each')?['fields']?['AmountDue']?['confidence']
        
    • When you're done, the window looks similar to the following image:

      Screenshot of the Send an email (V2) window with completed fields.

  21. Select Save in the upper left corner.

    Screenshot of the Logic Apps Designer save button.

Note

  • This current version only returns a single invoice per PDF.
  • The "For each loop" is required around the send email action to enable an output format that may return more than one invoice from PDFs in the future.

After you save your Logic App, if you need to make an update or edit your For each node will look similar to the following image:

Screenshot of the For each node after the app has been saved.

  1. Search for and select SharePoint from the search bar once more. Then, select the Get file content action.

  2. Complete the fields as follows:

    • Site Address. Select your SharePoint site.
    • File Identifier. Select this field. A dynamic content pop-up appears. If it doesn't, select the Add dynamic content button below the field and choose Identifier.
    • Infer Content Type. Select Yes.

    Screenshot of the Get File Content node.

  3. Next, we're going to add another new step to the workflow. Select the ➕ New step button underneath the newly created SharePoint node.

  4. A new node is added to the Logic App designer view. Search for "Form Recognizer (Document Intelligence forthcoming)" in the Choose an operation search bar and select Analyze invoice from the list.

    Screenshot of Analyze Invoice action.

  5. Now, you see a window where to create your connection. Specifically, you're going to connect your Form Recognizer resource to the Logic Apps Designer Studio:

    • Enter a Connection name. It should be something easy to remember.
    • Enter the Form Recognizer resource Endpoint URL and Account Key that you copied previously. If you skipped this step earlier or lost the strings, you can navigate back to your Form Recognizer resource and copy them again. When you're done, select Create.

    Screenshot of the logic app connector dialog window.

    Note

    If you already logged in with your credentials, the prior step is skipped. Continue by completing the Analyze Invoice parameters.

  6. Next, you see the selection parameters window for the Analyze Invoice connector.

    Screenshot showing the analyze invoice window.

  7. Complete the fields as follows:

    • Document/Image File Content. Select this field. A dynamic content pop-up appears. If it doesn't, select the Add dynamic content button below the field and choose File content. This step is essentially sending the file(s) to be analyzed to the Document Intelligence prebuilt-invoice model. Once you see the File content badge show in the Document /Image file content field, you've completed this step correctly.
    • Document/Image URL. Skip this field for this project because we're already pointing to the file content directly from the OneDrive folder.
    • Include Text Details. Select Yes.
    • Add new parameter. Skip this field for this project.

    Screenshot showing the analyze invoice window fields.

  8. We need to add the last step. Once again, select the ➕ New step button to add another action.

  9. In the Choose an operation search bar, enter Outlook and select Outlook.com (personal) or Office 365 Outlook (work).

  10. In the actions list, scroll down until you find Send an email (V2) and select this action.

  11. Sign into your Outlook or Office 365 Outlook account. After doing so, you see a window where we're going to format the email to be sent with dynamic content extracted from the invoice.

    Screenshot of Send an email (V2) action button.

  12. We're almost done! Type the following entries in the fields:

    • To. Enter your personal or business email address or any other email address you have access to.

    • Subject. Enter Invoice received from: and then append dynamic content Vendor name field Vendor name.

    • Body. We're going to add specific information about the invoice:

      • Type Invoice ID: and append the dynamic content Invoice ID field Invoice ID.

      • On a new line type Invoice due date: and append the dynamic content Invoice date field invoice date (date).

      • Type Amount due: and append the dynamic content Amount due field Amount due (number).

      • Lastly, because the amount due is an important number we also want to send the confidence score for this extraction in the email. To do this type Amount due (confidence): and add the dynamic content Amount due field confidence of amount due. When you're done, the window looks similar to the following image.

      Screenshot of the completed Outlook fields.

      Tip

      If you don't see the dynamic content display automatically, use the Search dynamic content bar to find field entries.

  13. Select Save in the upper left corner.

    Screenshot of the Logic Apps Designer save button.

    Note

    • This current version only returns a single invoice per PDF.
    • The "For each loop" around the send email action enables an output format that may return more than one invoice from PDFs in the future.

Test the automation flow

Let's quickly review what we completed before we test our flow:

  • We created a trigger—in this scenario. The trigger is activated when a file is created in a pre-specified folder in our OneDrive account.
  • We added a Document Intelligence action to our flow. In this scenario, we decided to use the invoice API to automatically analyze an invoice from the OneDrive folder.
  • We added an Outlook.com action to our flow. We sent some of the analyzed invoice data to a pre-determined email address.

Now that we created the flow, the last thing to do is to test it and make sure that we're getting the expected behavior.

  1. To test the Logic App, first open a new tab and navigate to the OneDrive folder you set up at the beginning of this tutorial. Add this file to the OneDrive folder Sample invoice.

  2. Return to the Logic App designer tab and select the Run trigger button and select Run from the drop-down menu.

    Screenshot of Run trigger and Run buttons.

  3. You see a message in the upper=right corner indicating that the trigger was successful:

    Screenshot of Successful trigger message.

  4. Navigate to your Logic App overview page by selecting your app name link in the upper-left corner.

    Screenshot of navigate to overview page link.

  5. Check the status, to see if the run succeeded or failed. You can select the status indicator to check which steps were successful.

    Screenshot of Succeeded or Failed status.

  6. If your run failed, check the failed step to ensure that you entered the correct information.

    Screenshot of failed step.

  7. After a workflow run succeeds, check your email. There's a new email with the information we specified.

    Screenshot of received email message.

  8. After you're done, disable or delete your logic app so that usage stops.

    Screenshot of disable and delete buttons.

Congratulations! You completed this tutorial.

Next steps