gs.getUserID() is not working ?

manmathpanda
Giga Guru

Hi Developers,

I have a table as u_shift_allowances_temp and there are 20 records and i want to fetch no.of records which are assigned to "assigned_to" members.

for this i wrote

var rca_table=new GlideRecord("u_shift_allowances_temp");
rca_table.addQuery("u_assigned_to",'00b6ea5edbabba80189d73200f96197b');


rca_table.addQuery('u_state', 'CONTAINS', 'Rejected');

rca_table.query();
while(rca_table.next())
{

gs.print("print:" + rca_table.getDisplayValue('u_assigned_to'));

}

 

In above query , 2nd line if i will write 

rca_table.addQuery("u_assigned_to",gs.getUserID());

It's not fetching any data instead if i will give sys_id of that user, its fetching the data .

Please suggest me what to do here, because i cann't give one sys_id because i want to show the reject records who has uploaded that.

 

 

Regards,

Manmath

 

 

6 REPLIES 6

Mukesh Sharma
Giga Expert

ideally gs.getUserID() should work but try  gs.getUserID()+''  instead of gs.getUserID() 

I am having somewhat same issue. I want the user sys id of currently logged in user.

And the requirement is I want it on server side i.e. in Script Include.

I am trying this:

    var user_name = gs.getUserName();

    var userSysId = gs.getUserID();

 

But in both the case, it only returns system. But expected results are different.

So how to get correct username and userID on server side in script include.

 

It will be great help as it is blocking me.

 

Thanks in advance.

 

Kaushal