This article was created in response to a support issue logged with K2. The content may include typographical errors and may be revised at any time without notice This article is not considered official documentation for K2 software and is provided “as is” with no warranties.
This KB guides you on how to return values from a workflow to a view, without binding the SmartObject or view to the workflow.
Before You Begin
Please complete the steps below:
A. Create workflow
1. Add the Data Field event and add all your variables under the Variable item in the Context Browser.
2. Add created variables into the workflow Data Field, put in their values (ABC, XYZ etc.) and then add Send Email Event.
B. Create View
1. Create Data labels and Text Areas corresponding to the data fields added in the workflow.
2. Add a Click Button, Additional Data Label, and Timer control inside your view.
C.1. Create Rule A
1. Add a new rule and configure the When Button is clicked rule.
2. Add an Action rule; Start a Workflow, and inside the Configuration, expand to System Values and drag the 'Current Date and Time' to Folio on the Input Mappings. Then click next.
3. On Output Mappings expand to your workflow name under Environment Fields/WorkflowName/Workflow. Drag ID to your additional Data Label that was added in the view earlier and click finish.
4. Add the Action rule: Execute a SmartObject Method.
5. Configure this action rule: choose the ‘Timer’ control and choose the ‘Start’ method and then click OK when done.
C.2. Create Rule B
1. Add a new rule and configure the 'When Timer is Ticked rule'.
2. Add an Action rule: 'Execute a SmartObject Method' and configure it: Choose the ‘Process Data’ SmartObject found in Workflow Reports/Workflow General/Helper. Choose the List method and then configure.
3. Click on rule configuration i.e ‘configure.’ On the Input Mappings, expand the ‘Controls’ folder, drag and drop the additional Data Label (created on the view earlier) to ‘Process Instance ID’.
On the Data Name Input Properties, type in the name of the variable you have created earlier in the Workflow, e.g. "Data1." Then click next to open Output Mappings.
4. Inside Output Mappings, expand to your SmartObject/Methods/List/Return Properties. Drag and drop Data Value to your control.
Note: This process needs to be configured for each and every control on the view individually. This means that when you type Data1 in Data Name Input Properties corresponding to the Variable name created in the Workflow, then on the Output Mappings drag and drop the Data Value to the control that corresponds to theData Name typed in the Input Mappings Input Properties.