cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
ducnguy
Level: Power Up

Creating Invoice Recognition with AI Builder and Outlook

Hi community,

 

I am struggling with a small issue for this small use case:

Whenever an email with an invoice attachments arrives, the AI Model Form Processing shall recognize the fields in Power Automate.

So my flow looks like this:

 

01.PNG

 

When testing the model, I receive an error:

 

2.PNG

 

The output:

{"statusCode":400,"headers":{"Cache-Control":"no-cache","Set-Cookie":"ReqClientId=14281e76-b9b2-4c04-87a0-579dfc629798; expires=Wed, 22-Jan-2070 10:00:45 GMT; path=/; secure; HttpOnly; samesite=none,orgId=58e08be0-368c-42b8-9756-efb138db8e60; expires=Wed, 22-Jan-2070 10:00:45 GMT; path=/; secure; HttpOnly; samesite=none","Server":"Microsoft-IIS/10.0","x-ms-service-request-id":"8a9447fb-501a-4398-b212-0d915e43da5c","Strict-Transport-Security":"max-age=31536000; includeSubDomains","REQ_ID":"8a9447fb-501a-4398-b212-0d915e43da5c,8a9447fb-501a-4398-b212-0d915e43da5c","AuthActivityId":"f1cda75a-a951-46e2-ae5b-a80ed9055c09","x-ms-ratelimit-burst-remaining-xrm-requests":"5992","x-ms-ratelimit-time-remaining-xrm-requests":"1,199.28","OData-Version":"4.0","X-Source":"102091601141571092723823468492348314022092135823817168228226245931571312116111414833,806447155302011548110139164112161148224184114128011812410812519721784165296622818449","Public":"OPTIONS,GET,HEAD,POST","Timing-Allow-Origin":"*","X-Powered-By":"ARR/3.0,ASP.NET","Date":"Wed, 22 Jan 2020 10:00:45 GMT","Content-Length":"3398","Allow":"OPTIONS,GET,HEAD,POST","Content-Type":"application/json; odata.metadata=minimal","Expires":"-1"},"body":{"error":{"code":"0x80040265","message":"{\"operationStatus\":\"Error\",\"error\":{\"type\":\"Error\",\"code\":\"InvalidPredictionInput\",\"message\":\"Invalid property identifier character: “. Path '', line 2, position 0.\"}}","innererror":{"message":"{\"operationStatus\":\"Error\",\"error\":{\"type\":\"Error\",\"code\":\"InvalidPredictionInput\",\"message\":\"Invalid property identifier character: “. Path '', line 2, position 0.\"}}","type":"System.ServiceModel.FaultException`1[[Microsoft.Xrm.Sdk.OrganizationServiceFault, Microsoft.Xrm.Sdk, Version=9.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]]","stacktrace":"   at Microsoft.Crm.Extensibility.OrganizationSdkServiceInternal.Execute(OrganizationRequest request, InvocationContext invocationContext, CallerOriginToken callerOriginToken, WebServiceType serviceType, Boolean checkAdminMode, ExecutionContext executionContext, Dictionary`2 optionalParameters)\r\n   at Microsoft.Crm.Extensibility.OData.CrmODataExecutionContext.Execute(OrganizationRequest request, ExecutionContext executionContext)\r\n   at Microsoft.Crm.Extensibility.OData.CrmODataServiceDataProvider.ExecuteOperation(CrmODataExecutionContext context, EdmOperation edmOperation, Dictionary`2 parameters, Dictionary`2 boundParameters)\r\n   at Microsoft.Crm.Extensibility.OData.ActionController.ProcessOperationRequest(String operationName, Dictionary`2 operationParameters, EntityReference entityReference, String boundEntityName, String boundEntityType)\r\n   at Microsoft.Crm.Extensibility.OData.ActionController.<>c__DisplayClass11_0.<PostBoundAction>b__0()\r\n   at Microsoft.PowerApps.CoreFramework.ActivityLoggerExtensions.Execute[TResult](ILogger logger, EventId eventId, ActivityType activityType, Func`1 func, IEnumerable`1 additionalCustomProperties)\r\n   at Microsoft.Xrm.Telemetry.XrmTelemetryExtensions.Execute[TResult](ILogger logger, XrmTelemetryActivityType activityType, Func`1 func)\r\n   at lambda_method(Closure , Object , Object[] )\r\n   at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.<>c__DisplayClass10.<GetExecutor>b__9(Object instance, Object[] methodParameters)\r\n   at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ExecuteAsync(HttpControllerContext controllerContext, IDictionary`2 arguments, CancellationToken cancellationToken)\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at System.Web.Http.Controllers.ApiControllerActionInvoker.<InvokeActionAsyncCore>d__0.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at System.Web.Http.Controllers.ActionFilterResult.<ExecuteAsync>d__2.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at System.Web.Http.Dispatcher.HttpControllerDispatcher.<SendAsync>d__1.MoveNext()"}}}}

 

Do you know how to solve this issue?

Thanks a lot! 

 

EDIT: When doing some research, I found this blog: Our Best Practices and Step-By-Step Guide for creating an enterprise scale automated invoicing proce... . The Predict connector in the video looks completely different than mine. Do you know why:

 

3.PNG

1 REPLY 1
Power Apps Staff JoeF-MSFT
Power Apps Staff

Re: Creating Invoice Recognition with AI Builder and Outlook

Hi @ducnguy,  

The predict action as shown in the video is an enhancement not yet available but that will be released soon. Stay tuned. 🙂

 

For the current experience, you will need to put the base64 an mimeType value between quotes. 

Also you will need to apply a function to the content of the email. More info on this on step #8: https://docs.microsoft.com/en-us/ai-builder/form-processing-model-in-flow


8. Select the form processing model you want to use, and specify this Request Payload:

  • For a .jpeg image of the form:

    {
        "base64Encoded": "EXPRESSION",
        "mimeType": "image/jpeg"
    }
  • For a .pdf document of the form:

    {
       "base64Encoded": "EXPRESSION",
      "mimeType": "application/pdf"
    }
  • In the formula bar on the right, replace Expression with the following expression:

    string(triggerBody()?['file']?['contentBytes'])

    Note

    Depending on which connector the file comes from, the expression will need to be enclosed by base64() instead of string()

     

     

    @ducnguy

Helpful resources

Announcements
firstImage

Power Platform Online Conference

Join us for the first ever Power Platform Online Conference!

firstImage

Coming Soon: T-shirt Design Contest

Keep your eyes open for our upcoming T-shirt design contest!

firstImage

Incoming: New and improved badges!

Look out for new contribution recognition badges coming SOON!

firstImage

New & Improved Power Automate Community Cookbook

We've updated and improved the layout and uploading format of the Power Automate Cookbook!

thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Top Solution Authors
Top Kudoed Authors
Users online (6,075)