Document flow
Documents participating in a process, for example, a hearing or a submission, are selected in the InitForm in the document control:
When the InitForm starts the process, the documents are handed to the process in the form of a Record[] of type Scanjour.Process.Client.Lite.Record[] in an InArgument called Documents:
The workflow passes these arguments to the ParallelUserTask or SequentialUserTask activities in the activity properties.
The most important properties are Attachments and Properties:
- Attachments
Indicates which documents should be attached to the mail. The Attachments property is a string[] which stores the names of the properties where the documents are listed.
In the simple case where there are only documents in one property, the Attachments property is hardcoded with New String() {“Documents”} (VB syntax).
- Properties
Holds the Record[] in a dictionary that the user task converts to a UserTaskPropertyCollection. The Properties property is a dictionary with one entry, which is the documents array: New Dictionary(Of String, Object) From {“Documents”, Documents}.
When using this way of specifying the documents, you will also be able to create more sophisticated processes that have more document controls in the InitForm.
If you have documents and references where you want to attach only the documents to the mail, the references would still be the documents, but the Properties would be: New Dictionary(Of String, Object) From {{“Documents”, Documents},{“References”, References}}.
When a user task is created in the database table wzp_user_task, the properties are stored together with the user task. The user task goes through all properties defined in the properties collection and completes the information in the record structure. It furthermore adds other properties that are needed when the user task is shown in Outlook. The database contains the following properties:
{
"Documents":
{"key":"Documents","type":"Scanjour.OData.Client.Lite.WorkZone.Record[]",
“value":[{"TypeName":"Som.Record","MediaResource":null,"ID":"6",
"Actions":[],
"Properties":[
{"key":"ID","type":"System.String","value":"6"},
{"key":"FileKey_Value","type":"System.String","value":"81"},
{"key":"State_Value","type":"System.String","value":"UÅ"},
{"key":"RecordType_Value","type":"System.String","value":"DOK"},
{"key":"DocumentType_Value","type":"System.String","value":"Word.Document.12"},
{"key":"Title","type":"System.String","value":"WordDokument"},
{"key":"Summary","type":"System.String","value":"D-6, WordDokument, 29-10-2014"}],
"SubEntries":[],
"Feeds":[]},
{"TypeName":"Som.Record","MediaResource":null,"ID":"7",
"Actions":[],
"Properties":[
{"key":"ID","type":"System.String","value":"7"},
{"key":"FileKey_Value","type":"System.String","value":"81"},
{"key":"State_Value","type":"System.String","value":"UÅ"},
{"key":"RecordType_Value","type":"System.String","value":"DOK"},
{"key":"DocumentType_Value","type":"System.String","value":"Excel.Sheet.12"},
{"key":"Title","type":"System.String","value":"ExcelSpreadSheet"},
{"key":"Summary","type":"System.String","value":"D-7, ExcelSpreadSheet, 29-10-2014"}],
"SubEntries":[],
"Feeds":[]},
{"TypeName":"Som.Record","MediaResource":null,"ID":"8",
"Actions":[],
"Properties":[
{"key":"ID","type":"System.String","value":"8"},
{"key":"FileKey_Value","type":"System.String","value":"81"},
{"key":"State_Value","type":"System.String","value":"UÅ"},
{"key":"RecordType_Value","type":"System.String","value":"DOK"},
{"key":"DocumentType_Value","type":"System.String","value":"PowerPoint.Show.12"},
{"key":"Title","type":"System.String","value":"PowerpointPresentation"},
{"key":"Summary","type":"System.String","value":"D-8, Powerpoint, 29-10-2014"}],
"SubEntries":[],
"Feeds":[]},
{"TypeName":"Som.Record","MediaResource":null,"ID":"9",
"Actions":[],
"Properties":[
{"key":"ID","type":"System.String","value":"9"},
{"key":"FileKey_Value","type":"System.String","value":"81"},
{"key":"State_Value","type":"System.String","value":"UÅ"},
{"key":"RecordType_Value","type":"System.String","value":"DOK"},
{"key":"DocumentType_Value","type":"System.String","value":"txtfile"},
{"key":"Title","type":"System.String","value":"TextDocument"},
{"key":"Summary","type":"System.String","value":"D-9, TextDocument, 29-10-2014"}],
"SubEntries":[],
"Feeds":[]}
]
},
"FileNo":{
"key":"FileNo","type":"System.String",
"value":"14-10/2"
},
"Officer":{
"key":"Officer","type":"System.String",
"value":"TESTADMIN"
},
"OfficerName":{
"key":"OfficerName","type":"System.String",
"value":"Test Administrator, TESTADMIN"
},
"Register":{
"key":"Register","type":"System.String",
"value":"FILE"
},
"RegisterKey":{
"key":"RegisterKey","type":"System.String",
"value":"81"
},
"InstanceId":{
"key":"InstanceId","type":"System.String",
"value":"a8a7a50c-d10b-4871-8890-e290ac525659"
},
"TaskId":{
"key":"TaskId","type":"System.String",
"value":"22"
}
}
When a user task mail is rendered, a number of UserTaskResponse are included in the mail. Here the property information is part of the UserTaskResponse, and the properties are updated to honor any restrictions that access codes may impose on the user who receives the mail.
A user task response looks as shown below:
(For readability, the type information shown below is removed).
{"$type":"Scanjour.Workflow4.Base.UserTaskResponse, Scanjour.Workflow4.Base, Version=4.0.0.0, Culture=neutral, PublicKeyToken=null",
<responsetemplates>
<responsetemplate name="Actions">
"Action":null,
"Comment":null,
"Properties":
"Documents":
"key":"Documents","type":"Scanjour.OData.Client.Lite.WorkZone.Record[]",
"value":[
"ID":"6",
"Actions":[],
"Properties":[
"key":"ID","type":"System.String","value":"6"},
"key":"FileKey_Value","type":"System.String","value":"81"},
"key":"State_Value","type":"System.String","value":"UÅ"},
"key":"RecordType_Value","type":"System.String","value":"DOK"},
"key":"DocumentType_Value","type":"System.String","value":"Word.Document.12"},
"key":"Title","type":"System.String","value":"WordDokument"},
"key":"Summary","type":"System.String","value":"D-6, WordDokument, 29-10-2014"}],
"SubEntries":[],
"Feeds":[]},
"ID":"7",
"Actions":[],
"Properties":[
"key":"ID","type":"System.String","value":"7"},
"key":"FileKey_Value","type":"System.String","value":"81"},
"key":"State_Value","type":"System.String","value":"UÅ"},
"key":"RecordType_Value","type":"System.String","value":"DOK"},
"key":"DocumentType_Value","type":"System.String","value":"Excel.Sheet.12"},
"key":"Title","type":"System.String","value":"ExcelSpreadSheet"},
"key":"Summary","type":"System.String","value":"D-7, ExcelSpreadSheet, 29-10-2014"}],
"SubEntries":[],
"Feeds":[]},
"ID":"8",
"Actions":[],
"Properties":[
"key":"ID","type":"System.String","value":"8"},
"key":"FileKey_Value","type":"System.String","value":"81"},
"key":"State_Value","type":"System.String","value":"UÅ"},
"key":"RecordType_Value","type":"System.String","value":"DOK"},
"key":"DocumentType_Value","type":"System.String","value":"PowerPoint.Show.12"},
"key":"Title","type":"System.String","value":"PowerpointPresentation"},
"key":"Summary","type":"System.String","value":"D-8, PowerpointPresentation, 29-10-2014"}],
"SubEntries":[],
"Feeds":[]},
"ID":"9",
"Actions":[],
"Properties":[
"key":"ID","type":"System.String","value":"9"},
"key":"FileKey_Value","type":"System.String","value":"81"},
"key":"State_Value","type":"System.String","value":"UÅ"},
"key":"RecordType_Value","type":"System.String","value":"DOK"},
"key":"DocumentType_Value","type":"System.String","value":"txtfile"},
"key":"Title","type":"System.String","value":"TextDocument"},
"key":"Summary","type":"System.String","value":"D-9, TextDocument, 29-10-2014"}],
"SubEntries":[],
"Feeds":[]}]},
"FileNo":
"key":"FileNo","type":"System.String","value":"14-10/2"},
"Officer":
"key":"Officer","type":"System.String","value":"TESTADMIN"},
"OfficerName":
"key":"OfficerName","type":"System.String","value":"Test Administrator, TESTADMIN"},
"Register":
"key":"Register","type":"System.String","value":"FILE"},
"RegisterKey":
"key":"RegisterKey","type":"System.String","value":"81"},
"InstanceId":
"key":"InstanceId","type":"System.String","value":"a8a7a50c-d10b-4871-8890-e290ac525659"},
"TaskId":
"key":"TaskId","type":"System.String","value":"21"}},
"Answers":null,
"Identity":null}
</responsetemplate>
</responsetemplates>
Information about the documents is the information on the rendering time of the mail. In order for the mail to obtain actual values for the documents, the user task has maintained the list of documents in a child table to the wzp_user_task table named wzp_user_task_attachments.
This table has the following information:
task_id: Thetask_idof the user task.record_id: Therecord_keyof the document.property_name: The property name that the record is part of.priority: The order in the property.attach: Is set to True if the record will be attached to the mail.
The user task mail can obtain information about the current list of documents and their titles from OData through the register wzp_user_task_attachment because the record table is an extension table in this register:
http://sjunittest/OData/WzpUserTaskInserts?&$filter=TaskId eq'<task_id>' and PropertyName eq ‘Documents’&$expand=Records&$select=RecordId,Records/Title&$orderby=Priority
This allows the mail to show an up-to-date list of documents in the mail while still honoring the access code protection of the documents.