User Criteria to see Order Guide based on user profile variable

HenryD
Tera Guru

Hello, I am trying to make an order guide available for users that currently have the organization "Texas" on their user profile, I am running a script which is below in the "Available for" tab on the order guide. it is making me create a user criteria so I chose the advance selections, currently my script isn't working and would like feedback OR any other way of doing this is appreciated, tyia

 

 

 

 

 

var userGR = new GlideRecord('sys_user');

userGR.get(gs.get(user_id));

 

if (userGR.getValue('u_organization') == '(Texas'){

      answer = true;

}

else{

    answer = false

 

 

1 ACCEPTED SOLUTION

SwarnadeepNandy
Mega Sage

Hello @HenryD,

Try using this script

var userGR = new GlideRecord('sys_user');
userGR.get(user_id);
answer = (userGR.getValue('u_organization') == 'Texas');

Hope this helps.

Kind Regards,

Swarnadeep Nandy

View solution in original post

3 REPLIES 3

SwarnadeepNandy
Mega Sage

Hello @HenryD,

Try using this script

var userGR = new GlideRecord('sys_user');
userGR.get(user_id);
answer = (userGR.getValue('u_organization') == 'Texas');

Hope this helps.

Kind Regards,

Swarnadeep Nandy

@SwarnadeepNandy Hello thank you this is actually what im looking for, by chance do you know a script that would be the same however if the orgainzation is "Texas" & "Oklahoma"? can you display what that code would be? i know it has something to do with the "||" but i cant seem to figure it out 

Hello @HenryD,

var userGR = new GlideRecord('sys_user');
userGR.get(user_id);
answer = (userGR.getValue('u_organization') == 'Texas' || userGR.getValue('u_organization') == 'Oklahoma');

I think this will work.

Kind Regards,

Swarnadeep Nandy