Question
How can I compose a WorkflowGen hyperlink to a File type process data?
Method
Note: The method below applies to WorkflowGen version 5.2 and earlier. WorkflowGen 5.3 and later include an out-of-the-box functionality that allows for file attachments in WFG email notifications. See the How to add a file attachment to my WorkflowGen email notification? article for more information.
In order to compose a hyperlink to a File type process data in WorkflowGen, you must first query the database to retrieve information relating to the actual file. The following SQL query will extract the necessary information to build the hyperlink. The hyperlink created will respect both WorkflowGen and process data security
Query
select w.id_process , wir.id_reldata, wir.id_dataset from wfprocess_inst_reldata wir left join wfreldata w on wir.id_reldata=w.id_reldata join wfdataset_value wv on wir.id_dataset=wv.id_dataset join wfprocess_inst wi on wir.id_process_inst=wi.id_process_inst where w.name='[DataElementName]' and wir.id_process_inst=[requestID]
Query parameters:
-
[DataElementName]
= WorkflowGen data name (e.g.FORM_ARCHIVE
) -
[requested]
= WorkflowGen request number
Result
The SQL query will return three column values:
-
id_process
: The WorkflowGen process ID -
id_reldata
: Related data ID for the target process data -
id_dataset
: ID of the process data
URL
Once you’ve obtain these three values, you can compose the URL for the file download link:
http://[your server name]/wfgen/show.aspx?QUERY=DATASET_FILE_DOWNLOADID_PROCESS=[id_process]ID_RELDATA=[id_reldata]ID_DATASET=[id_dataset]NUM_VALUE=1ATTACHMENT=[SaveDocumentPopup]
For [SaveDocumentPopup]
, use N
to open the document in a browser, or Y
to open save document