How do I Build a Workflow that Includes Corrections Routing?

Modified on Wed, 21 Feb at 3:30 PM

Sometimes forms are submitted and an approver a few workflow steps down the line catches a mistyped budget code or another mistake that needs to be corrected. Rather than rejecting these submissions and asking the original submitter to start again, you can design a workflow pathway that can optionally circle back to an existing step. 


Building a workflow that includes corrections routing is a complex design but saves time for both submitters and approvers when the form is in use. This article will guide you through adding corrections routing to a form and using the rejection message to provide feedback to the original submitter. 


  1. Add Radio, Actions, and Text Components to the Form Layout
  2. Connect the Workflow Pathway and Add Assignments
  3. Customize the Assignment Email to use Reject Reason


Each section will include code snippets that you can copy directly into the form you're working on. If you have questions about how to adjust them to match the process you're looking for, please reach out to us


Add Radio, Actions, and Text Components to the Form Layout


Radio Component to Determine Pathway

If you would like your form approvers to have the option to choose between a permanent rejection or sending a submission back for corrections, you'll need to create a conditional workflow route from their workflow step because both options will utilize the Reject button. In order to create a conditional workflow route, we'll need to reference data from the submission layout. 


Our professional services team likes to use a Radio component so the user can choose the pathway they want to use. You can use the visual editor to create a similar Radio component or copy the code snippet below into your form layout. We then hide this component in the Visibility layer until the approver step(s) where it should be used. 


  <Radio
        id="nextAction"
        label="Next Action"
        options={[
          "Approve the Submission",
          "Return for Revisions",
          "Permanently Reject",
        ]}
      />


Actions Components to Provide the Correct Buttons


This radio component can be used in conjunction with one or more Actions components so each user sees the appropriate buttons for their step. Typically, this means using multiple Actions components and using display logic and our currentStep() helper function to hide or show them at each step. The code snippet below also uses text template replacement to change the button text to match the selection made in the Radio component. All of this, like changing the display logic or the button text, can be done in the visual editor in the Action's properties panel. You can also copy and adjust the code snippet below to fit the step IDs for your form. 


    <Actions display="currentStep() === 'start' />
    <Actions
      display="currentStep() === 'approverStep' && nextAction === 'Approve the Submission'"
      enableReject={false}
      rejectText="##nextAction##"
    />
    <Actions
      display="currentStep() === 'approverStep' && nextAction !== 'Approve the Submission'"
      enableSubmit={false}
      rejectText="##nextAction##"
    />


Making Corrections Required Notes Visible to the Original Submitter


When a submission is returned to the original submitter, you can add a section to the form that highlights any notes about things that need to be corrected. This will save approvers from needing to contact the original submitter outside of Droplet and will increase the likelihood that changes are made correctly. 


To add this correction notes section, we're going to use the notes that are saved in "_reason" when the Reject button is pressed. The window that opens for the approver, looks similar to the image below. 



Anything saved in this window will be stored in _reason for us to use in the form layout. We like to create a text block that displays in red at the top of the form so the user making corrections can see what is needed and any approvers can see what had been flagged in a previous rejection. We use display logic to only show this section when a correction is needed.



The code snippet for this is below.


<Section
    id="correctionsReason"
    wide={false}
    background="#FAFAFA"
    display="typeof _reason !== 'undefined' && nextAction === 'Return for Revisions'"
  >
    <Text color="#FF0000" fontSize={18}>
      This submission was flagged for corrections. Please ensure that the
      following issues are addressed:
      <br />
      <br />
      <i>##_reason##</i>
    </Text>
  </Section>


_Reason is also available to use with the Rejection routing
If you would like to save the reason a submission was rejected on the submission, you can use a similar Text component to save the _reason. You can also access this _reason in notifications.




Connect the Workflow Pathway and Add Assignments


Simple Corrections Routing


There are a few ways you handle routing for rejections and corrections. If you prefer to only have a send for corrections options and no permanent rejection at all, you can simply replace the workflow routing that would typically go to the Rejected step to instead send back to any previous step. This may look like the workflow routing below. 


Corrections Workflow that directs the submission back to the original submitter when rejected from the Human Resources step.


This type of pathway can still utilize the permanent rejection option at another step. You can see an example of this in the workflow pathway image below. This kind of rejection and corrections pathway is just making use of the Reject button and sending the submission down a single path each time the Reject button is pressed. 



Conditional Corrections Routing


If you are giving an approver the option to choose between sending the submission for corrections or rejecting it, you will need to use the Radio component you set up earlier to create a conditional pathway from the approver's step. 


You can connect the workflow steps on the canvas and then set up conditional routing on the Reject pathway for each step. You will use the ID of the radio component and the action the person has selected to write the expression. 



You could also make updates to the onReject routing in the code editor similar to the code snippet below if you prefer to work in the code editor. 


 "onReject": [
        {
          "if": "nextAction === 'Return for Revisions'",
          "target": "start"
        },
        {
          "target": "rejected"
        }
      ],


The image and the code snippet above are exactly the same, both create a list of options for the submission to check before moving the submission forward. If the expression is true that's associated with the first if property, it will route the submission to that target, and if the next is true, it will route to that one. The last target without the if expression will be used if none of the above are true. In this case, we are checking to see which selection is made on the Radio component.


You will need a similar conditional rejection pathway at every workflow step where your approvers can choose between sending the submission for corrections or rejecting it. 


Assigning a Workflow Step to the Original Submitter


If you are returning a submission to the original submitter at any step for them to make their corrections, you'll need to add a dynamic assignment to reassign the submission to the original submitter using the helper function getSubmittedBy() in the expression.


Customize the Assignment Email to use Reject Reason


The original submitter will receive a generic "You have a new assignment on Droplet" email when their submission is sent back for corrections unless this assignment email is customized. We recommend always customizing emails when corrections are required to eliminate confusion for the user. You can also access the _reason notes to use in this email so the submitter knows what they need to correct before they open their submission. 


You can do this within the Notifications tab on the workflow step that will be re-entered on the rejection. You will use string interpolation to add the _reason notes to the body of the email. Or you can use a code snippet like the one below to create your custom reassignment email.


 "start": {
    "onEnter": [
      {
        "type": "assignment",
        "template": {
          "subject": "Revisions Requested on your Form",
          "body": "<p>Hello ##submission.submittedBy.name##,</p><p>Your form has been reassigned to you for the following revisions:<ul><li>##submission.data._reason##</li></ul></p><p><br/><br/>Please click <a href='##submission.assignmentUrl##'>here</a> to complete your revisions.</p><p>Thank You.</p>"
        }
      }
    ]
  },


With the addition of this custom assignment email, your corrections routing workflow is now complete! We recommend you test this new pathway by publishing and submitting your form and then asking one of the workflow approvers to choose the option to send the submission for corrections. This way you can ensure that all assignments and notifications are working correctly.  


Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article