IBM Support

Finding out who the current user is

Technical Blog Post


Abstract

Finding out who the current user is

Body

Many times, it is required to programmatically determine the log-on name of the current user. The following javascript can be used in the handy JavaScript Adapter widget to do just this.

Note how you could use the previous ICM Settings example to programmatically assemble the REST URL instead of hard coding it as it is below.
 
var getUserURL = "http://ICMServer:9080/CaseManager/P8BPMREST/p8/bpm/v1/currentuser?cp=P8…;;
var xmlhttp= null;
xmlhttp= new XMLHttpRequest();
xmlhttp.open('GET' , getUserURL , false); xmlhttp.send();
var myResObj = eval('(' + xmlhttp.responseText + ')');
var myUser = myResObj.name;

[{"Business Unit":{"code":"BU053","label":"Cloud & Data Platform"},"Product":{"code":"SSCTJ4","label":"IBM Case Manager"},"Component":"","Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"","Edition":"","Line of Business":{"code":"LOB45","label":"Automation"}}]

UID

ibm11281826