Lazy Approval Tool Plugin

Introduction

The Lazy Approval Tool Plugin allows users to approve or reject assignments via an email URL without needing to log into Joget. The source code for this plugin is available in the JogetOSS repository.

Danger
This plugin may pose security risks. Exercise caution when using it.

Plugin information

  • Plugin Name: Lazy Approval Tool
  • Joget Compatibility: Joget DX 8

Get started

Prerequisites

  1. Set up SMTP values in the Joget App so the email tool works properly.

    See Sign in with app passwords to generate the password for SMTP Gmail and General Settings > SMTP Settings.  
  2. API Domain/IP Whitelist must be set up for security purposes.
    To ensure the successful operation of this plugin, it is essential to whitelist the host's domains or IP addresses. Typically, this involves adding the IP address or domain name of your Joget application server to the whitelist. To access this section of Joget, go to Settings > General Settings and scroll down until you see the API Domain/IP Whitelist section.
    Important
    You will get a 400 Forbidden error when clicking on approve/reject if this is not set.

    Fields to configure: 
    • API Domain Whitelist (Separated by ';'): Domain whitelist to allow API calls to Joget Workflow. Separated by semicolon.

      Example: localhost;www.joget.org;marketplace.joget.org, or * to allow from everywhere. In a production environment, do not use *. Doing so will allow anyone to call all JSON APIs from the Joget server.

    • API IP Whitelist (Separated by ';'): IP address whitelist to allow API calls to Joget. Separated by semicolon.

      Example: localhost; 192.168.101.10; www.joget.org;marketplace.joget.org, or * to allow from everywhere. In a production environment, do not use *. Doing so will allow anyone to call all JSON APIs from the Joget server.

Where to get the plugin

You can download the plugin from the GitHub Repository.

How to install

  1. Download the plugin JAR file from the releases page.
  2. Go to Settings > Manage Plugins > Upload Plugin.
  3. You can import the demo app or create the app from scratch.

How to use it

Importing the demo app

  1. Download the demo app.
  2. Go to Joget Home or All Apps and click on Import App to import the downloaded demo app.

Creating app from scratch

  1. The first part of the app is the form. This form gathers the user's name and email address (this can be any field as they are not important for the plugin flow).
    The Select Approver select box will be the value for the Workflow Variable assignee, which we will use in the workflow process later.

  2. Inside the form are hidden fields that keep track of the approval status. These hidden fields must be exactly the same as it is case sensitive to be picked up in our plugin code.

  3. The second part of the sample app is the process. This is the process of a single activity.
  4. You will need to duplicate the route twice for multiple activities, as you should call the lazy approval tool again to run the second activity.
  5. By breaking out the process step by step, the first process starts off by prompting the user to submit the form.
    Once the form has been submitted, the Lazy Approval Tool will be triggered. To configure the tool, check out Lazy Approval Tool Properties.
    • Form: The form field will be the existing form we created in Step 1.
    • Process: The process will be the process that needs lazy approval (in this demo, we use the current process)
    • Activity: the activity will be the activity that needs lazy approval inside the configured process
    • Assignee (Participant ID): this will be the approver (participant ID) in the process whereby we configured the assignee (created in form in step 1) to the Approver.
    • Workflow Variable (Status): This will be the workflow variable used to configure the status of approved/rejected.


  6. After the lazy approval tool is triggered, the Email Tool will be triggered. The Lazy Approval Tool will generate a URL based on the configurations. Then, you can pass the URL to the Email Tool using Hash Variable. You can refer to Figure 9 for the Email Tool Configurations.


    HTML for Email Tool

    Please approve or reject the assignment:

    <a href="#form.lasa_cust.assignment_URL_approved#">Approve</a>

    <a href="#form.lasa_cust.assignment_URL_rejected#">Reject</a>

  7. After the Email Tool, you will add activity 1, which the lazy approval link will approve.

  8. Then, a decision route will be deciding the route based on the status chosen from the Email. If approved, it will send an approved email, if rejected, it will also send a rejected email.

  9. You can create a UI to show the processes and an Inbox list to show the process list.
  10. Drag the Run Process, attach the single activity, and rename it to Run Process Approval (Single Activity).
  11. Do the same for the multiple activities and rename it to Run Process Approval (Multiple Activity).
  12. .Drag the inbox list and rename it to Process List.
Run the plugin
  1. To test on a single activity, go to the Run Process Approval (Single Activity) form and fill it. Ensure the approver configures an email address in the Users section.
  2. In Process List, you will see that a process is running.
  3. Check your email, you will receive an email for the selected approver's email.
  4. Click the email and click Approve or Reject.
  5. If Show Redirect Popup Page After Action is checked in the Lazy Approval Tool configuration, you will be directed to a page saying assignment completed with all the details. After that, you can close the window. You can see similar details in Monitor > Running Processes, as shown in Figure of the steps 2.


  6. After that, go back to the app and view the Process List. You will see that the assignment has been successfully completed.
  7. There will be an email saying the assignment was approved.
Note
You can also click on the approval link and perform the assignment in Incognito Mode, meaning your Joget App does not have to be signed in to perform the task. Therefore, the assignee to which the URL is sent to is important not to share with unauthorized users.

Configure lazy approval tool properties

Fields to configure:

  • Form: The form of the process. Mandatory field.
  • Process: The process value to generate the lazy approval link. Mandatory field.
  • Activity: The activity value to generate the lazy approval link. Mandatory field.
  • Assignee (Participant ID): The assignee who will be assigned to perform the assignment. Mandatory field.
  • Workflow Variable (Status): The workflow variable that defines the approve or reject status. Mandatory field.
  • Show Redirect Popup Page After Action: If checked, a redirect popup page will be shown after a user performs the action by clicking on the lazy approval link.

Expected outcome

The user can approve or reject the assignment outside of the Joget App. By utilizing the email tool to send an email with the URL, the user can click on the URL to perform assignment approval or rejection.

Download plugin

Download the plugin from the GitHub Repository.

Download sample app

Download the demo app for Lazy Approval Tool Plugin:
Created by Julieth Last modified by Aadrian on Nov 19, 2024