I have a link on my web page that allows a user to start a workflow process.  Unfortunately, every time a user clicks on the link, a new instance of the same workflow is created.  I only want them to start one instance of a workflow at a time.

Is there a workflow property that would limit the user so that they cannot run multiple instances of the same workflow (while another instance is running)?

  • No labels

1 Comment

  1. Hi Shannon Whitley,

    Currently there is no direct way to achieve this, but there is a workaround that requires you to write some java coding:

    1. Go to your App under "Design Apps" > "Processes" > your process, find "Process Start White List" under the "Map Participants to Users".

    2. Click on the "Add/Edit Mapping". In the popup dialog, go to "Map to Plugin" tabs, tick  "Bean Shell Tool" and click the "Submit" button on the bottom.

    3. A large text area will appear before you, please insert and modify the code below into the text area. Then, click on the "Submit" button on right bottom.

    import java.util.*;
    
    Collection users = new ArrayList();
    
    //Do some checking here
    boolean canRun = true;
    
    //Check for submitted form data, if data exists, set canRun to false
    
    if (canRun) {
        users.add("#currentUser.username#");
    } else {
        users.add("");
    }
    return users;

    Let me explain a little bit here. Process Start White List is used to check on who can start the process. By default, if there is no username returned, meaning everyone can start the process. In the coding above, you will need to add your own checking, and if the user is allowed to start the process, set variable "canRun" to true. What it does is just add current logged in user's username to the return list (users) if the user allow to run the process, else it will just add a dummy username to the return list. 

    Hope this help.

    Regards,

    Owen