1
0
-1

Hi ,

I have a system whith a multiple approval by :Process Enhancement Plugin#MapActivitiestoForms-MoreSettings

My problem is when the one of the approver managers chooses: (clarification), re-requesting approval is sent to everyone (even those who previously chooses approve it).

How can I re-request approval to the person who only asked for clarification?

    CommentAdd your comment...

    1 answer

    1.  
      1
      0
      -1

      In your approver swimlane, you will need to add logic to pick up who has approved before and only return those never approved before.

      In your approver's swimlane, you can configure it to point to beanshell participant plugin with the following code.

      import java.util.ArrayList;
      import java.util.Collection;
      import org.joget.commons.util.LogUtil;
      import java.sql.Connection;
      import java.sql.PreparedStatement;
      import java.sql.ResultSet;
      import java.sql.SQLException;
      import javax.sql.DataSource;
      import org.joget.apps.app.service.AppUtil;
      
      //list down all approvers
      Collection assignees = new ArrayList();
      
      assignees.add("cat");
      assignees.add("jack");
      assignees.add("mike");
      
      //find out who has already approved and remove them from assignees
      
      Connection con = null;
      try {
          // retrieve connection from the default datasource
          DataSource ds = (DataSource)AppUtil.getApplicationContext().getBean("setupDataSource");
          con = ds.getConnection();
          
          // execute SQL query
          if(!con.isClosed()) {
              PreparedStatement stmt = con.prepareStatement("SELECT createdBy from app_fd_#appDef.appId#_pd where c_status = 'Approved'");
              ResultSet rs = stmt.executeQuery();
              while (rs.next()) {
                  String user = rs.getObject("createdBy");
                  assignees.remove(user);
              }
          }
      } catch(Exception e) {
          LogUtil.error("Participant Mapping", e, "Error loading user data in participant mapping");
      } finally {
          //always close the connection after used
          try {
              if(con != null) {
                  con.close();
              }
          } catch(SQLException e) {/* ignored */}
      }
      
      return assignees;

      I tested this code and it worked on mine. You can adjust to your needs.

      1. Haya

        Thank you so much Walter

        Do you mean to add it by beanshell tool ? But where exactly is the process?

        this my process 


        I have 4 levels Apprpval , in every level i used multi select box to select the many approver
        How can I modify the code for it ?

        Excuse me please, I'm using Joget recently .

      CommentAdd your comment...