Last change: 30.04.2020

Purpose and Use Case
This example shows how to use the internal document representation STGDocument, that represents the complete document hierarchy loaded into DR, to check or propagate field values from a root document to child documents. Access to the STGDocument is now available from the C# interface in DR (available in DR 2.2.3 and higher) and the field values are correctly updated and displayed for documents that are not the current documents.
Note: Since the Reviewables are re-loaded each time when a document is changed by the user, the Reviewables for other than the current document are correctly updated when only the fields in STGDocument are changed for other documents in the tree. For the current document the field values still need to be changed directly in the Reviewables so they are updated in the UI immediately.
Example: In a structured document consisting of a root document and children of different document types a value is entered in a field in the root document. The custom plugin is called when the user presses enter and copies the value into a field in each child of a certain document. For example, this access can be used to copy an insurance number from a cover letter to each single document in a folder. Or to check if the number is the same on each subdocument. Or to calculate the sum of all amount fields of all subdocuments to compare with the summary sheet.
What it does
A structured document consists of a root document and child documents of either the type “Document Type 1” or “Document Type 2”. Each of them contains a field.
The user types a value (“test”) in the field of the root document. A message box is popped up from the custom plugin to ask the user if the value should be propagated (copied) to the child of type “Document Type 2”. If yes then the field in this child is filled with the value “test”.
Note: The additional field that can be seen is used to enforce a confirmation by the user with a simple confirmation rule so the validation flow directly jumps to this document otherwise the document would be valid and closed.
Or here as video:
Realization
The behavior is achieved by full access to the document with DocumentValidators (available in DR 2.2.3 and higher). The DocumentValidators required a plugin in C# for this layout.
The sample code can be downloaded from below with Vinna DocType, layout.json and validation.json.