It's all about IAM

How to get LoggedIn User ID on Process Form

Requirement:
We need to see that who has modified particular field on Process Form or we want LoggedIn "User Login" on Process Form for some purpose


Solution:
Here are the steps to accomplish the same:

Note: I am demostrating the solution using Process Task Adapter. You can use other options as well as per requirement

  • Create Java Code

public String printLoggedInUser(tcDataProvider dataProvider){
        System.out.println("INSDIE printLoggedInUser ");
        String loggedInUserID = "";
        try {
            loggedInUserID = dataProvider.getUserLogin();
            System.out.println("loggedInUserID :: " + loggedInUserID);
        } catch (tcDataAccessException e) {
            e.printStackTrace();
        } catch (tcClientDataAccessException e) {
            e.printStackTrace();
        }
        return loggedInUserID;
    }

  • Make JAR file and paste in /xellerate/JavaTasks directory
  • Create Process Task Adapter and map variables as below
                          Input - Adapter Reference - Database Reference 
                          Output - Return Variable
































  • Build the Adapter
  • Attach your Adapter with a Task in the Process Definition. 
  • Call this task on Successful Updation of Attribute Task
  • Map the Adapter Return Value with 
  • Process Data -- Form Field say UD_TEST_LOGGEDIN 
  • Save and Test

No comments:

Post a Comment