Completing Assignments using API

Last Updated: 07/19/2018 Introduced in Version: 2.0

Overview

Sometimes you have a workflow that’s designed and working well but you want to add a new facet to it that automatically completes tasks based on things happening outside the flow.  For example you have a form task for someone to upload a document and this is part of a process that’s working well.  You realize later that you could start to automatically watch for this document to be uploaded and send it into the flow automatically.  

This situation is usually a great opportunity to use the ‘Wait on Event’ flow step or an ‘External Form’ step.  These steps, or the SDK, are great ways to deal with workflows where you don’t actually want a user to work the task, however; Sometimes you have a workflow with a form and it’s great and you just want to make a separate process outside of your workflow that monitors something and causes the task to be worked as though the user had replied to their email or filled out the form.

Solution:

The solution is to use the ProcessFormAssignmentResponse from the Toolbox category: Integration/InternalServices/Assignment

Notes:

  1. This step requires that the Form Assignment that you are trying to process that has Email Handling enabled.  
  2. This step processes one of the Action Based Outcomes and not one of the Form’s buttons.  
  3.  

Example

We start in the Designer Folder with creating a Flow A that will have an assigned Form in it. Click Create Flow Button on the Folder Actions Panel.

 

In the resulting window we Name our Flow and click Create to proceed to the Flow Designer.

 

First, we are going to create a Process Folder for the Task to keep track of Task’s states. We add Setup Process Folder step from All Steps [Catalog] > Flow Management > Data category in the Quick Add Step dialog.

 

2017-02-02_155307

 

Then, we configure our Setup Process Folder step (by clicking the step on the workspace and calling Step Information Layer) as following… We set Parent Folder as Current Folder, use Unique Number Prefix for the Folder name, and configure desirable Folder Name and Description. Next, we click Add Step.

 

2017-02-02_155536

 

Then, we add a Form to our Flow. This Form will be our Task that we want to be able to Complete with the other Flow.

 

2017-02-02_160929

 

After we have designed our Form and returned back to the Flow Designer, we need to configure it. In the Assignment Settings we change Assignment Type from In Session to Assigned, and using [edit] link we add an assignee to this Form.

 

2017-02-03_093554

 

It is important that this Form should have Email Response Handling configurations. For this example we set Email Response Handling to Default.

 

2017-02-03_093729

 

To explore Email Response Handling in more detail, refer to the doc:  Handling Task Assignment Via Email Response or Embedded Links

Next, we configure Email Response handling as desired.

Note: email address that we want to use in the From field should be monitored with Email Response Job Schedule.

Next, we need to add an outcome to our Form that will be triggered with our External Flow later in this tutorial. We do it in Action Based Outcomes section by clicking Add New link.

 

2017-02-03_101102

 

In the resulting pop-up window we configure our Outcome and click Ok to save and close this window. We need to memorize the Name that we assigned to this outcome because we will use it in our second Flow.

 

2017-02-03_101218

 

Back to the workspace, we add another Assigned Form (in this example it will be just Next Task in our workflow).

 

2017-02-03_101649

 

Finally, we connect steps in our Flow as following, and save and close Flow Designer.

 

2017-02-03_103459

 

Now, we can create a Monitor Flow that will Complete the Task that is being assigned in the first Flow which we have just created. In the Designer Folder we click Create Flow.

 

Then, we Name our Flow and click Create to proceed to the Flow Designer.

 

 

For simplicity of our example we will design this Monitor Flow to get the recent Assignment and to Complete it. First, we add GetMyAssignmentsByAge step from Integrations > All Integrations > Internal Services > Assignment category.

 

2017-02-03_103843

 

Then, we add ProcessFormAssignmentResponse step from the same category next to the GetMyAssignmentsByAge step on the workspace.

 

2017-02-03_104024

 

Next, we select GetMyAssignmentsByAge step on the workspace and configure it to return an array of Assignments created within 5 minutes.

 

2017-02-03_133218

 

Then, we select ProcessFormAssignmentResponse on the workspace and choose Edit Input Mapping Option.

 

2017-02-03_134704

 

In the Mapping Editor we use First Assignment’s AssignmentID from the array that GetMyAssignmentsByAge step returns us as data field for the assignmentId. In the response field we use Constant Mapping Type and in its Value field we type the Outcome Name that we have added to the Assigned Form in the Flow A in this tutorial. When finished we can click Ok to save and close Mapping Editor.

 

2017-02-03_135151

 

Back in the Flow Designer we connect our steps as following and this completes our Monitor Flow. We can save and close Flow Designer.

 

2017-02-03_135334

 

To test, we Run our Flow A first.

 

2017-02-03_135511

 

Pop-up window asks us if we want to fill in the Form that was assigned to us, and we Reject it.

 

2017-02-03_135638 

 

Mention, that Process Folder was created for our Flow Data.

 

2017-02-03_141000

 

In this Process Folder we can see that our Assignment’s state is Current.

 

2017-02-03_141051

 

If we go back to the Designer Folder and Run our Monitor Flow

 

2017-02-03_141201

 

We can see a new pop-up Notification that informs us about Next Task Assignment. This is the second Assigned Form in our Flow A. It means that First Assigned Form was worked out.

 

We can confirm this by navigating to the Process Folder for this Assignment. Here, we should be able to see that our First Assignment’s State was changed to Completed, and Next Task Assignment showed up with the Current Assignment State.

 

2017-02-03_150600

 

 

 

Additional Resources