GET STARTED
DOCUMENTS
APPS
API
INTEGRATION
GALLERY
Retrieving User Details

This section explains and gives an example of how to retrieve some detail information about the user who is logged in. To access these functions you must precede the function call with Providers.getSessionProvider(). The SessionProvider object lets the developer access runtime information about the current user.

Methods
public String getCurrentUserId()Returns the User ID of the person logged into the system.
public String getCurrentOrgId()Returns the Organization ID that the person logged into the system belongs to.
public String getCurrentOrgName()Returns the Organization Name that the person logged into the system belongs to.
public Long getCurrentUserNumericId()Returns the numeric ID of the person logged into the system.
public String getLocale()Returns the Locale of the person logged into the system. e.g., en_US, fr_CA, zh_TW, zh_CN, es
public Set<String> getCurrentOrgRoles()Returns all of the roles that are played in this transaction by the organization that the person logged into the system belongs to. For example, if the transaction is anchored to an order, the roles this org plays in the order will be returned.
Example
/**
 *  Get Session Provider data
 */
function copySessionProviderData(thisDoc, eventname, params) {
    thisDoc.requesterID = Providers.getSessionProvider().getCurrentUserId();
    thisDoc.requesterOrgID = Providers.getSessionProvider().getCurrentOrgId();
    thisDoc.requesterOrgName = Providers.getSessionProvider().getCurrentOrgName();
    thisDoc.requesterOrgRoles = Providers.getSessionProvider().getCurrentOrgRoles().toString();
    Providers.getPersistenceProvider().save(thisDoc);
}

The xml of thisDoc would include...

<requesterID>buyerA@companyBuy.com</requesterID>
<requesterOrgID>5717989018001111</requesterOrgID>
<requesterOrgName>Company Buy</requesterOrgName>
<requesterOrgRoles>NotifyParty,ObjectCreator,Buyer,Consignee,Licensee</requesterOrgRoles>