getUserSessionId function

z/OSMF core creates a unique ID for the authenticated user for every browser tab or window in which the user has z/OSMF or a z/OSMF task opened. Your task can use the ID for any purpose. To retrieve the ID, call the getUserSessionId function.

Invoking the function

To call the getUserSessionId function, use the syntax shown in Figure 1.

Figure 1. Syntax to use to call the getUserSessionId function
win.global.zosmfExternalTools.getUserSessionId();

The session ID has the form userName_timestamp, where userName is the ID the user used to log into z/OSMF, and the timestamp is the date and time the user logged into z/OSMF or opened z/OSMF or a z/OSMF task in a new browser tab or window. The timestamp is based on the locale and time zone setting for the user's browser.

Example

Figure 2. Sample code for the getUserSessionId function
var userSessionID;
function init(){
  //Create a unique session ID for the session to track if multiple 
  //instances of the application are open.
  userSessionID=win.global.zosmfExternalTools.getUserSessionId();

  //This session ID can be used in any client side logging.
}