Order Guide user criteria more than 1 organization

HenryD
Tera Guru

Hello, I'm trying to create a User Criteria "Available For" in the order guide for a user that are apart of these two organizations. I've gotten their sys_ids and put them in the code, I verified it works with one organization but now I need it to display when a user is a part of 2 organizations, I have displayed my code using the AND / && in the script but it is not working, does anyone have any suggestions or something I can try that will work? thank you in advance 

 

 

var userGR = new GlideRecord('sys_user');
userGR.get(user_id);
answer = ((userGR.getValue('u_organization') == '94b528771b217550c1fbedfde54bcbef') && (userGR.getValue('u_organization') == 'ba16a8771b217550c1fbedfde54bcb5b')

 

 

2 REPLIES 2

SanjivMeher
Kilo Patron
Kilo Patron

Use an OR statement. AND will check both Org value together

 

var userGR = new GlideRecord('sys_user');
userGR.get(user_id);
answer = ((userGR.getValue('u_organization') == '94b528771b217550c1fbedfde54bcbef') ||(userGR.getValue('u_organization') == 'ba16a8771b217550c1fbedfde54bcb5b')


Please mark this response as correct or helpful if it assisted you with your question.

Hello, thank you for your input, i need an AND staement, right now the user has both of these organizations in the user profile, im using the AND because i need the order guide to display when a user has both of these organizations in the user profile.