Skip to main content

Notifications

Power Apps - AI Builder
Answered

How to use an AI Model with invoices and save the data to SQL Server?

(0) ShareShare
ReportReport
Posted on by 173

I've been going through the documentation, videos, etc, learning about AI Builder.  I've been able to create an AI Model with two different invoice types.  I've created a flow that watches an email folder, uses the AI Model to parse the attached PDF and shows me the data.  This works great as a test, however, it's not quite what the business wants for this project.

 

What I'd really like to do, and can't find any good help on, is when an email arrives, the attached pdf is parsed, if the confidence level for any of the fields is less than 85% have someone manually review the attachment and update/approve the changes.  Once the invoice has either passed with a confidence of 85% or more, or someone has updated/approved the changes, the data parsed off the invoice will go into a SQL Server table.  I'd also like to send an email when an invoice needs manual review so people don't have to check the app all the time - invoices can come at any time and several times in a day.

 

Under AI Builder is Document Automation.  I've tried that but run into two problems.  The first is mapping the invoices to the fields.  In my model, I have fields for all of the invoice types, but not all fields are in all invoices (one has Rate, one doesn't).  In the mapping I marked those fields as not in this collection.  However, when it processes an invoice, it is saying the invoice needs manual review because those fields are blank.  I know they are blank, and always will be, but I can't figure out how to get Document Automation to ignore those fields.  The other problem is after a document has been approved (or came through with no errors), it's done, there isn't an option to do something with that data.  How do I move it to SQL Server?  Also, when I looked at the flows that are created with Document Automation there's a bunch of Dataverse actions that I have never heard of.

 

I'm good with using the Document Automation app if I can figure out my issues, and I'm ok with creating something new from scratch.  Does anyone have any suggestions of where to learn about all this stuff?  Thanks very much!!

Categories:
  • RichardUchytil Profile Picture
    RichardUchytil 173 on at
    Re: How to use an AI Model with invoices and save the data to SQL Server?

    I've got it working up to the validation step.  Last night I had the idea of doing just what you said for importing into SQL - trigger a flow when the Status changes to "Validated".  I'm also going to create a flow that triggers when the status changes to "Manual Review" and sends an email to the reviewers.  Nice to get confirmation that this is the correct way to do it.  Thanks!

  • Verified answer
    CedrickB Profile Picture
    CedrickB on at
    Re: How to use an AI Model with invoices and save the data to SQL Server?
    • Sending an email when in manual review: add a new step in the Document Automation validator flow sending an email when relevant
    • Send in manual review only when certain fields are empty. Again you can edit the condition in the Document Automation validator flow to check if one field is empty depending on the value of another field. The easiest way is to remove the loop which checks each fields one by one and rather do a big condition what will perform the checks for all fields.
      E. g
      data1 is empty
      or data2 is empty
      or
        data1 is not equal to "Something" /* if data1 equals "Something" you don't check if data3 is empty 
        and data3 is empty
    • Importing to SQL, you can copy the Document Automation validator flow change the trigger condition to the Validated status code and build your import logic there

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Microsoft Kickstarter Events…

Register for Microsoft Kickstarter Events…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Announcing Forum Attachment Improvements!

We're excited to announce that attachments for replies in forums and improved…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 145,445

#2
RandyHayes Profile Picture

RandyHayes 76,287

#3
Pstork1 Profile Picture

Pstork1 64,741

Leaderboard