Getting File Data From a DocumentLast Updated: 08/18/2016 Introduced in Verision: |
This tutorial demonstrates how to get data from the Document entity in Decisions.
Example:
In this example we are going to get data from the Document and display it on the Form.
First, we need to get Document ID. We locate our Document in Portal, right-click it > Manage > Get Document URL.
In the resulting window copy Document ID from the URL and click Ok to close the window.
Then, in the Designer Folder we click Create Flow on the Folder Actions Panel.
In the resulting window we Name the Flow and click Create to proceed to the Flow Designer.
In the Flow Designer we add GetDocumentData step from Integrations > All Integrations > Internal Services > Document Service category.
Then, with Get Document Data step selected on the workspace we define Constant documentId step Input with Document ID that we copied previously in this tutorial.
Get Document Data step returns FileData type. We can use it to create file or save the document locally. To display Document contents on the Form we need to get Text from FileData type. We add Get String From Bytes step from All Steps [Catalog] > Data > Text category.
Next, with Get String From Bytes step selected on the workspace, for the bytes Input we use Select Value Mapping type and pick Contents from GetDocumentData_Output.
Next to the Get String From Bytes step in our Flow we are going to add a Form to display the contents of our Document. We add Show Form step from the Favorite Steps category.
In the resulting window we Name our Form and click Create to proceed to the Form Designer.
We Design our Form as following… We use a Label component as our Form’s title, a Text Block component to display Document Data, and a Button component to close the Form. When finished we can save the Form and close Form Designer.
Back in the Flow Designer we connect our Form Step to the End Step in the Flow. Next, we select Form Step on the workspace to set up data for it. For the TextArea step Input we Select Value of the GetStringFromBytes_Output.
This completes our Flow. We can click Test Flow link on the top panel of the Flow Designer.
Our Flow runs in the Debugger. The Form opens and we should be able to see Document Data displayed on the Text Block component on the Form. Click Done button on the Form.
The Flow runs to the End Step with no issues.