Hi All,
I'm attempting to build a invoice processing workflow, wherein invoices are received via email (PDF attachments) and the workflow collects the data for processing. I've created a model in AI Builder, however, when it comes to my workflow, I can't seem to get the predict function to work successfully.
I've tried two different process I've found online, but both result in error when testing.
String + Attachments
Error:
Attachments only:
Error:
Would greatly appreciate any input on how to resolve this 🙂
Hi @Unity,
If you want to get the attachment content bytes of the arrived email, you should add the Get attachment action before. And seems like you want to convert it into Base64, you can use the base64() function, for example:
base64(body('Get_Attachment_(V2)')?['contentBytes'])
Best Regards,
Community Support Team _ Lin Tu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hey @Unity
What did you initially pass in the Attachments only screenshot that you have shared? Note that the attachments content retrieved from the dynamic selector in the When a new email arrives action is already a base64encoded string so you do not need to convert to a base64 again. Can you check and confirm on this one?
Hope this Helps!
If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!
I was only copying the instructions I read here in regards to creating the workflow:
https://docs.microsoft.com/en-us/ai-builder/form-processing-model-in-flow
Should I get rid of the base64encoded sting then?
Hi All,
My Flow succeeded with the following Expression:
@Anonymous
Thanks for the info, I was wondering if you know what this error I'm getting might be?
I'm running the same string you listed (with the change to 'V3' instead). I don't have the option of 'Content Type' but I do have 'Attachments Content Type' that I'm using.
Any suggestions on how I can fix that error?
Cheers
Hey @Unity
You missed a step to get the attachments in the flow. Before the predict action, you need to add the get attachment action of the outlook connector and then you will be able to see the relevant dynamic data.
Hope this Helps!
If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!
Thanks for pointing that out @yashag2255, I've included that step and built out the rest of my workflow.
There's an odd thing though, whenever I run it I get the output I want (with all the internal steps showing green), but the "apply to all" shows up as an error. Do you know what might be causing this or how I might fix it?
Cheers
Hey @Unity
I believe you have two attachments on that email. Can you check and confirm? One might be an image or something that is not being read by the flow. In the apply to each, you see the "Next Failed" right, click on that one and you will be able to see more details on the error.
Hope this Helps!
If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!
Hi,
Does the process works without the "Parse JSON" and ""Apply to each 2" steps.
Guess the error is somewhere in those steps.
What exec. u doing in "Apply to each 2" ?
Cheers
Hi @yashag2255
I had a look and you're right, when I look at the next failed, it's a predict issue.
I'm not receiving multiple attachments in the email, but in the one attachment that is included (a pdf), there are multiple pages. Might that be the issue? Looking that the details in the failed output there is a mention of "Unable to process file. Image document dimensions (103x28) do not meet minimum requirements (530x100)". Originally I trained the model just to consider the first page of the attachments coming in.
@Anonymous, I didn't create the "apply to each 2" myself, the workflow forced me to do so, automatically, when entering one of the values:
User | Count |
---|---|
89 | |
37 | |
26 | |
13 | |
13 |
User | Count |
---|---|
127 | |
54 | |
38 | |
24 | |
21 |