Scanning Receipts into Dataverse using Power Apps and AI Builder

Roshan Mehta, 08 March 2022

Lots of organisations have a cumbersome process for submitting expense claims. You spend a few days out of town and collect physical receipts, which you then staple to a handwritten expense claim form and submit it to the finance person. It would be much nicer to take a photo of the receipt and automatically submit the expense claim through a mobile device. Thankfully, this can be achieved using Power Apps and the AI Builder.

Here is a very simple example where information is automatically captured from a receipt and the data is submitted to a table in Microsoft Dataverse.

Firstly, create a blank Power App and add the Receipt Processor control under the AI Builder menu. When you include this control in your app, it will tell you that this is a premium component which requires an AI Builder license. More information around pricing can be found here. Alternatively, you can sign up for a trial to test things out.


image


Next, add individual labels and fields for the data that you want to capture, as well as a Save button. I have included Name, Date, GST, and Total. Make sure you format the GST and Total fields as numbers and use a Date Picker for the Date. image

Next, set the Default property on each of the input controls as follows. This will set the input field values based on what the Receipt Processor picks up from the receipt.

Name

image

Date

image

GST

image

Total

image

Next, add a Data Source for Dataverse and select the table you want to submit the receipt data to. I am using a custom table called Expense Claim and have also included the User table so I can do a lookup and capture the name of the person submitting the receipt.

image

My form in Dataverse looks like this. I want the name of the person submitting the Expense Claim to appear in the Submitted By field as a lookup to the user table.

image

The last thing to do is to wire up the Save button so it submits the data to the Dataverse table. The OnSelect property of the button has the following function. Note that the GST and Total fields need to use the Value function to ensure it is parsed to the correct currency data type.


Patch('Expense Claims', Defaults('Expense Claims'),
{
     Name: TextName.Text,
     Date: DatePicker.SelectedDate,
     GST: Value(TextGST.Text),
     Total: Value(TextTotal.Text),
     'Submitted By': LookUp(Users,'Full Name'=User().FullName)
}
);

Save and publish the app, then try it out! You will see the data automatically captured via the AI Builder and submitted to Dataverse when you hit Save. You could then build additional automation through Flow to send an email or an Approval to the finance person to close the loop on the expense claim.

// Tactix campaign Linkedin Tag_April 2022