web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / AI Builder flow syntax...
Power Automate
Answered

AI Builder flow syntax - Predict (form processing)

(0) ShareShare
ReportReport
Posted on by 8

Hi,

I am attempting to take an email attachment and apply the Predict action (form processing) for each attachment. I've tried to follow the instructions here https://docs.microsoft.com/en-us/ai-builder/form-processing-model-in-flow but when I use the expression base64(items('Apply_to_each')) it doesn't work.

snip.png

I get this error message in the output: "{\"operationStatus\":\"Error\",\"error\":{\"type\":\"Error\",\"code\":\"InternalServerError\",\"message\":\"Status code action Unknown is not handled. error message : File content could not be parsed, was the mime type correct?\"}}"

 

The input message seems to look ok: 

item/request"{\n \"base64Encoded\":… \"application/pdf\"\n}"

 

Has anyone out there managed to sucessfully apply the predict action (form processing) to an email attachment?

 

Thanks

Rob

Categories:
I have the same question (0)
  • v-yamao-msft Profile Picture
    on at

    Hi @RobBoyers ,

     

    Could you try if the following function will work:

    base64(outputs('Get_attachment')?['body'])

     

    I am trying to make more tests on this issue, will back if I have got any updates.

     

    Best regards,

    Mabel

     

  • Rob Boyers Profile Picture
    8 on at

    Hi, thanks for reaching out. I'm still struggling I'm afraid.

    If it helps, My trigger action is Outlook: When a new email arrives, from a specific address with the subject of invoice. Has attachment = yes, Include attachments = yes.

    Loop for each: select an output from previous step: 'Attachments'

     

    Should be pretty simple, I must be missing something obvious here.

  • Rob Boyers Profile Picture
    8 on at

    Hi,

    I have made some progress with the input syntax but it appears the Predict step is struggling to handle pdf files.

    I used the expression 

    base64(triggerOutputs()?['body/Attachments']) and when the flow fails (bad request), the input appears to be ok.
    I added an if statement to ensure the attachment was of type application/pdf just to make sure.
    Here's the first few lines of the input;
    {"host":{"apiId":"subscriptions/24fa6447-0d7f-439d-9ee6-3b1984fec8b6/providers/Microsoft.Web/locations/westeurope/runtimes/europe-002/apis/commondataserviceforapps","connectionReferenceName":"shared_commondataserviceforapps","operationId":"Predict"},"parameters":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UklBQUFBQS8vK0NwbkloSUNrRkpFWEJQQm5LWXNnU1dCUVpBWVBNREZGV0FBQUFBUC8vQWljREQzQ2xGTVRnRG8yZkdFMmdRQkJEQU9XUmcyUVRBQUFBLy8raWdZZE16STMxTEkwdFVLd0JBQUFBLy8vQ2lCeGpZT1JBaWp0b2hXc0taSHVDL2V3Qkx1azlLSEtEc1FHd1pESTFWVEExTVlPN0FRQUFBUC8vd2hxb2tHS1JzcUlRSEtaSUZnRUFBQUQvL3dKYUpBb3NvcWdacHFhRzVucW13RFlFc2pVQUFBQUEvLy9Da1kyaFBnS1hUdjZVSjM0a0N3RUFBQUQvL3dKYTJBb3Nra0MrRVVUUHdqZ01CTFlYZ2VuYlVBR1RBYllGVlBvWkc0T2FlR1lHUmdvbUNrV3B2RnhwV3JCR0pWUXFGOVI0TTREeGNxQThRMk5FT3hLVkExY0hhVlJDL0cxSllwbHNhS1puWUdZQjlqWUFBQUQvL3dLM0V2MkJpZE1IM2pyRVVWa0h3cUxXbURUYlRDek45Y3dnalNrQUFBQUEvLzhDV2hhandSQU5qTDFRQmhkb0xXQU
    Here's the output:
    {"statusCode":400,"headers":{"Cache-Control":"no-cache","Set-Cookie":"ReqClientId=40abb475-1cba-4e49-8642-b4421b1cc6bc; expires=Fri, 21-Jun-2069 21:33:01 GMT; path=/; secure; HttpOnly,orgId=2e569944-1e69-404d-8df5-6e9b8ec42aaf; expires=Fri, 21-Jun-2069 21:33:01 GMT; path=/; secure; HttpOnly,ApplicationGatewayAffinity=7374892e0d5a6889c14a9b9e9065db1068800941fd22098d3410ac68d1f59365;Path=/;Domain=rboyerssandbox.crm4.dynamics.com","Server":"","x-ms-service-request-id":"d512e04a-bfb5-446b-8f48-ed1d9b4f368d","REQ_ID":"d512e04a-bfb5-446b-8f48-ed1d9b4f368d,d512e04a-bfb5-446b-8f48-ed1d9b4f368d","AuthActivityId":"7ff5b68e-ad66-48e0-b987-de8139f8afd3","x-ms-ratelimit-burst-remaining-xrm-requests":"59999","x-ms-ratelimit-time-remaining-xrm-requests":"11,997.82","OData-Version":"4.0","Public":"OPTIONS,GET,HEAD,POST","Date":"Fri, 21 Jun 2019 21:33:03 GMT","Content-Length":"3480","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\":\"InternalServerError\",\"message\":\"Status code action Unknown is not handled. error message : File content could not be parsed, was the mime type correct?\"}}","innererror":{"message":"{\"operationStatus\":\"Error\",\"error\":{\"type\":\"Error\",\"code\":\"InternalServerError\",\"message\":\"Status code action Unknown is not handled. error message : File content could not be parsed, was the mime type correct?\"}}","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()"}}}}
  • Narayana Swamy S Profile Picture
    42 on at

    Hi, I am not getting Predict option while adding next step.

     

    Capture.PNG

  • robboyers1 Profile Picture
    7 on at

    You have to create your flow within a solution else you don't get the predict action.

  • robboyers1 Profile Picture
    7 on at

    An update on the syntax you need to use;

    string(items('Apply_to_each')?['ContentBytes'])
    is what you need to parse a pdf NOT base64.
  • Narayana Swamy S Profile Picture
    42 on at

    Hi,

     

    As suggested, i have created a model driven app and try to create a flow within app but no use.

     

    Please suggest where i can define flow in solution.

  • Narayana Swamy S Profile Picture
    42 on at

    Hi @robboyers1 ,

     

    Thanks for the suggestion. Please guide how to create a flow in solution.

  • robboyers1 Profile Picture
    7 on at

    Hi,

    Go to make.powerapps.com > solutions > create your solution. Then click 'New > Flow'.

    You have to use make.powerapps.com, this doesn't work in the classic solution builder.

    Rob

     

  • Verified answer
    jyotipch Profile Picture
    29 on at

    This is actually straight forward:

     

    image.png

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 525 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 324 Moderator

#3
abm abm Profile Picture

abm abm 232 Most Valuable Professional

Last 30 days Overall leaderboard