OCR in Expense Management

I recently got to implement OCR in Expense management in Microsoft Dynamics 365 for Finance and Operations. Turns out, there is a lot of interest in this topic, so I put together a little blog about it. 


What is OCR? 

Optical Character Recognition. This is used to process documentation such as receipts and invoices by using Azure Cognitive Services to "read" the documentation and import the data into the system, cutting down on manual system entry.


Lifecycle Services

There is a component of installation that needs to be installed in your environment through Lifecycle Services (LCS). 

First, set up the Power Platform Integration. Use the standard template unless you are actively planning to use Dual-Write. 

As part of the setup, you are connecting your Finance and Operations environment to a Power Platform environment. Runtime features like Virtual entities, Business Events, and Dual-write all depend on this connection and thus it cannot be removed until you delete the Finance and Operations environment. For more information visit https://aka.ms/PPIExperienceChanges. To proceed, type your full name in the box below:

When connecting, this is the information you will see: 

Setup Power Platform Integration - This connot be reversed

As part of the setup, you are connecting your Finance and Operations environment to a Power Platform environment. Runtime features like Virtual entities, Business Events, and Dual-write all depend on this connection and thus it cannot be removed until you delete the Finance and Operations environment. For more information visit https://aka.ms/PPIExperienceChanges.

Wait, does this say "connot" in the title of the popup? Why yes it does. I had a really good tweet about this. 

Next, once the Power Platform Integration has been set up, click Install a new add-in and select Expense management from the list of add-ins. 


View of LCS environment with Expense management add-in tied to the environment


NOTE: This can only be done on Tier 2 environments or higher! 


Implementing OCR in Dynamics 365 F&O

There are two features that need to be enabled in the Feature management workspace:

  • Expense reports re-imagined

Description in D365FO: This feature provides a new Expense Management Workspace, a new setup form for expense fields visibility, and a redesigned expense report. 

Kelly's take: If you are using Expense management in D365FO, turn this feature on YESTERDAY. It is phenomenal. This workspace is a lot more user-friendly and provides great visuals as well. 

  • Auto-match and create expense from receipt

Description in D365FO: This feature leverages Optical Character Recognition to extract relevant data from receipt images and provide suggestive matches for existing expense records and allow end users to create easy creation of expense records in case there is no match. 

Kelly's take: My initial thought is that it's very intuitive and easy to use. I cannot wait to see how this gets expanded into the new mobile app and future iterations of the product!

 

View of the Feature management workspace and the two features that need to be enabled: Expense reports re-imagined and Auto-match and create expense from receipt
View of the Feature management workspace and the two features that need to be enabled: Expense reports re-imagined and Auto-match and create expense from receipt


Expense management parameters

There is a new section in Expense management parameters (Expense management > Setup > General > Expense management parameters) called Automatic receipt capture. This is where you need to provide a URL in the Receipt capture URL field. This will contain the URL for the Azure Cognitive Service that will be used to "read" the receipts you upload into D365FO. 


Expense management parameters


If you do not do this, you will see $0.00 value on the receipt and get a couple of errors that say "System failed to generate token based on certificate from local store." and "Cognitive service url is missing in the expense parameters."

System errors: "System failed to generate token based on certificate from local store." and "Cognitive service url is missing in the expense parameters."

 

Receipt Scanning

Once you upload your receipt whether it is via the (almost deprecated) mobile workspace, a scanned image, or a file, then attach it to an Expense report, OCR will begin trying to read the receipt. 

If the receipt is difficult to read, you can expect to see notifications such as these:

  • Not able to read what is printed in the receipt. This can be due to image quality or size. However, you can still proceed to reconcile the receipt with expense.
  • Tried to process the receipt 3 times. Unable to retrieve valid data.
  • Expense service client add security token operation returned true status. 


For reference, the worst receipt I scanned was found in my car. It was over a year old (yikes!) and it was faint and crumpled. OCR read it just fine. 


Okay, okay... it does say Qdoba Mexican Fats instead of Qdoba Mexican Eats, but to be fair, the receipt DOES look like it says that. 😉


Helpful Tips and Tricks for Receipt Image Quality

Now, getting a good image is likely fairly important. Here is what I recommend to get a good, readable image:

  1. Don't wait a year to submit your receipts. Just don't. It's a headache for the Finance team and your company probably won't pay it anyway. Old receipts are typically faded, crumpled, and difficult to read.
  2. Use good lighting. Words pop better when the lighting is good.
  3. If you have a scanner, and it's not too big of a hassle, use it. These always produce better documents than a phone camera, even if the phone camera is more convenient.
  4. When using your phone camera, hold your phone still while taking the picture.

Okay, I digress. That section was really more for fun. Do whatever you need to do to get your receipts turned in! 


Additional Documentation

Finally, here is the documentation from Microsoft that got me about 85% there:

Capture a receipt using OCR | Microsoft Docs



No comments: