cancel
Showing results for 
Search instead for 
Did you mean: 

At run time how to check the current user Logged on the system

Former Member
0 Kudos

Hi Experts

In the Cloud application studio, is there any way to access the current Logged in user ?

Like we do in ABAP with SY_UNAME

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hello,

You can get the current users Identity UUID by writing the following code.

var UUID = Context.GetCurrentIdentityUUID()

The context reuse library has the functions to get the Current System URL, date/time and User Date / Time  etc.

Hope this helps.

thanks & Regards,

Meghna

Former Member
0 Kudos

Hi Meghna,

Thanks for replying I have attached the screenshot.

I tried the item which you suggested.

Inside the content am not able to see my user ID. instead some thing else is appearing .

Here is the Comparison the ID which I have used to Log on to the System is more like SAP User ID but the content is displaying something else. How to get the Log ON id from this UUID Content

Former Member
0 Kudos

import AP.PC.IdentityManagement.Global;

var CurrentIdentityUUID;

var Call_query;

var query_identity;

var query_identity_selparams;

var query_identity_result;

var USERDATA;

CurrentIdentityUUID = Context.GetCurrentIdentityUUID();

  query_identity = Identity.QueryByElements;

  query_identity_selparams = query_identity.CreateSelectionParams();

  query_identity_selparams.Add(query_identity.UUID.content, "I", "EQ", CurrentIdentityUUID.content);

  query_identity_result = query_identity.Execute(query_identity_selparams);

  foreach (var instance in query_identity_result) {

    USERDATA = instance;

    break; 

  }

Then you can explore USERDATA to find the info you need...

Former Member
0 Kudos

Thanks William,

Appreciate your coding knowledge on CAS. 

Thanks again for helping in detail.

Regards,

Papps

Answers (0)