Using gs.getUserID() within .includes

gunishi
Tera Guru

Hi there, 

 

I am using gs.getUserId() in a condition for a UI action. 

 

What does this method return, is it the sys_id of the user?

 

If so will this work if I assign the variable and then use it in /includes as below:

 

var user = gs.getUserID();

 

approvers.includes(user);

 

 

Will this return true or false or just break? and if it breaks can I use the following syntax:

 

gs.getUserID().toString();

Thank you

G

2 ACCEPTED SOLUTIONS

@gunishi 

yes it returns sysId as string so no need to use toString() function

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

View solution in original post

@gunishi 

Sys_id itself string value.

View solution in original post

9 REPLIES 9

@gunishi 

Sys_id itself string value.

@gunishi 

yes it returns sysId as string so no need to use toString() function

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

shubhamdubey
Mega Sage

@gunishi 

I have attached the snapshot for your reference

string.PNG

gunishi
Tera Guru

Hi @shubhamdubey and @Ankur Bawiskar 

 

Thank you both for your help, I have managed to use this now in a script 🙂

Kind regards, 

G

@gunishi 

 

It's my pleasure i could help you.

 

Thank you.