cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
ducnguy
Microsoft
Microsoft

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
JoeF-MSFT
Power Apps
Power Apps

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
MPA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

V3_PVA CAmpaign Carousel.png

Community Challenge - Giveaways!

Participate in the Power Virtual Agents Community Challenge

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

R2 (Green) 768 x 460px.png

Microsoft Dynamics 365 & Power Platform User Professionals

DynamicsCon is a FREE, 4 half-day virtual learning experience for 11,000+ Microsoft Business Application users and professionals.

Top Solution Authors
Users online (1,224)