Retrieve logged in user in UserApp forms

Sometimes you need to know which user is using a form of a workflow, e.g. to control the form fields depending on user attributes or group memberships. This is not a problem for the request form because UserApp provides the initiator as a process property. But the User Application does not provide a function or property telling you the DN of the user using an approval form.

The solution is a custom service that gets the user DN from the application server.

Here are the steps needed to add this functionality to the UserApp:

    1. Stop the application server and backup the IDM war file.

  1. Copy the IDM war into a temp directory and open the war with an archiving tool.

  • Download one of the attached files according to your UserApp version.

  • Rename the file from zip to jar and copy it into the WEB-INF/lib directory of the war file.

  • Extract and open the UIControlRegistry.xml located in WEB-INF directory.

  • Add the following lines in the service section of the UIControlRegistry.xml

 <service resultType="json" authenticated="true" config="true">

  1. Save the UIControlRegistry.xml and copy it back to the WEB-INF directory of the IDM war.

  • Copy the IDM war to the deploy directory of the application server and start the User Application.

Now you can execute the service within a script of any workflow form.
	var loggedInUser;
var serviceResult = IDVault.execService("loggedInUser", null);
if(serviceResult != null) {
loggedInUser = serviceResult._data.raw;

The loggedInUser variable now contains the DN of the user.




How To-Best Practice
Comment List
Parents Comment Children
No Data