Getting user location from user table via glide record

Sneha39
Mega Guru

Hi ,

I have to call script include after getting user location from user table via glide.

Kindly help me with script .

PS : I have to call assignment lookup script include which will assign a group based on user location taken from the user table

Thanks in advance

5 REPLIES 5

Mike Allen
Mega Sage

scriptIncludeName(current.user.location) would work if you have the user field as a reference on the table.



var user = new GlideRecord('sys_user');


user.get('<sys_id of the user>');   // or user.get('user_name', '<user id of the user>');



scriptIncludeName(user.location);


Hi Mike,



It is showing undefined on background script .



I tried this :



var user = new GlideRecord('sys_user');


user.get('2892312d4f1f3200da95e9628110c79e');


gs.print(u_AssignmentLookup(user.location));




Thanks


Hello Sneha,



Updated code:



var user = new GlideRecord('sys_user');


user.get('2892312d4f1f3200da95e9628110c79e');


gs.print( new u_AssignmentLookup(user.location));



Please try this and let us know if you are blocked.


Hi Sneha,



Good Day



Please find the updated script below for your reference :



var user = new GlideRecord('sys_user');


user.get('2892312d4f1f3200da95e9628110c79e');


var assignmentGroup = new u_AssignmentLookup(); /*calls the script include*/


var result = yourFunctionName(user.location);/*calls the specific function by passing the location of the user in the parameter*/



Hope it will helps you out!



PS: Hit like, Helpful or Correct



Thanks,


Priyanka R