Wait For Form Task And Resume Activity Results In Error Type 'Newtonsoft.Json.Linq.JToken' Is A Recursive Collection Data Contract Which Is Not Supported

The "Wait for Form Task and Resume" activity is used in a process. When trying to capture the data from the form's output variable, the following error is thrown " Type 'Newtonsoft.Json.Linq.JToken' is a recursive collection data contract which is not supported. Consider modifying the definition of collection 'Newtonsoft.Json.Linq.JToken' to remove references to itself UiPath Orchestrator" .

In order to fix this, re-design the project as follows:

  1. Create a separate xaml file
  2. In this separate xaml file, initialize a new Out argument of type List and use as object type the type you setup as output from the Create Document Validation Action
  3. In an individual sequence, use Deserialize json on the config.json file. The generated JsonObject output should be kept in the scope of this sequence
  4. In another sequence include all the activities related to the DU process, like: Deserialize json, Load Taxonomy, Classify Document, Data Extraction Scope, Create Document Validation, etc.
  5. After the Create Document Validation Action, add the activity "Add to Collection" and add the outputs of the previous activity into the collection (the out Argument) you previously created
  6. In the Main.xaml file, invoke the other xaml file and from "Import arguments", import the out argument of List type and give it as value a variable of the same type
  7. Use a Parallel for Each (or a regular For each) to iterate through each item of the said List
  8. In the Body of the activity, add the Wait For Document Validation Action And Resume.