Processing multiple invoices using Document Understanding Model and Action

@Ioana_Gligan Since I was modeling your sample code that you posted previously, could you please take a look at this post and let me know if you have any thoughts? Really appreciate this as it is time sensitive.

I have successfully implemented the Document Understanding model including Create Document Validation and Wait for Validation activities. This works well for a single invoice, but this is not practical at all in real life commercial A/P departments.

I found a sample workflow that using parallel processing to manage multiple documents. When I tried it, I got the error message below. The first invoice made it through as an Action, but the 2nd occurrence caused an error.

I am trying to build a demo for a prospect for the middle of the week.

The automatically determined extracted results references do not match the Document Object Model. They may have been created using a different Document Object Model.

at UiPath.IntelligentOCR.Activities.BaseOrchestratorClientAsyncActivity.ThrowIfNeeded(Task task, Boolean suppressThrowException)
at UiPath.IntelligentOCR.Activities.BaseOrchestratorClientAsyncActivity.EndExecute(AsyncCodeActivityContext context, IAsyncResult result)
at System.Activities.AsyncCodeActivity.System.Activities.IAsyncCodeActivity.FinishExecution(AsyncCodeActivityContext context, IAsyncResult result)
at System.Activities.AsyncCodeActivity.CompleteAsyncCodeActivityData.CompleteAsyncCodeActivityWorkItem.Execute(ActivityExecutor executor, BookmarkManager bookmarkManager)

Hello @Philly_Rob,

You are probably using variables within the parallel for each loop that are scoped outside the parallel for each and they get overwritten in two parallel branches. Try to set your variable scope within the body of the parallel for each (for the variables that are specific to each document being processed).

Hope this helps and apologies for the delay!


I limited the scope of the variables but got this runtime error. Can you explain please?

Yes. In order for a process to be able to suspend, all variables need to be serializable. You probably have some variable that is not serializable.

The reason for this requirement is that the robot must be able to save its state so that on resume it can pick up where it left off .

1 Like

Hi Philly and @Ioana_Gligan ,

Can you please point me to the sample code for Processing Multiple invoices using DU and Action center.

I am actually struggling to achieve and the sample code will be of great help.

Thanks in Advance!


Hello Rajiv,
Were you able to get right solution?
In case yes can you please help me with the same?


Hi @rohit.tomar0510

Welcome to community.

Do you want to process multiple invoices present on a single PDF file?


Hello Suraj,
Not multiple invoices on single pdf but different pdf’s in parallel for each so that presents data validation in Action Centre can be done simultaneously for all pdf’s


Hi @rohit.tomar0510

Its recommended to process one single invoice each time while using “Wait and Resume” activity.

You can have a dispatcher where you can Add the File paths to the queue.

And then the performer (Queue based trigger) which picks up each File and process it.


Hi @suraj.setty , I want to process multiple invoices present on a single pdf. each invoice is of same supplier and format, but can be one page or multiple pages.

Thanks in advance.

You can train invoice with different variations of pages in a machine learning model and use a machine learning info extractor. This way you can extract all pages with the same taxonomy.

Worked for Me.

Added All the Variable Scope to Parallel Foreach it Worked

and Created Multiple Document Pending in Action Center.

But the issue is that it is Wait for Document Validation & Resume is pausing too long even after completing the Task in Action Center.

I have Just changed the Scope.

My Requirement : To Create Multiple Invoice Validation Task To Same Time.