user criteria on order guide

Vinya Jakkula
Tera Contributor

Hello team can anyone help me.

I have used below script based on user location order guide should visible.

var userGR = new GlideRecord('sys_user');
userGR.get(user_id);
answer = (userGR.getValue('location') == 'Vancouver - Great Northern Way');
1 REPLY 1

Maddysunil
Kilo Sage

@Vinya Jakkula Please add some log to debug

 

 

var userGR = new GlideRecord('sys_user');
    if (userGR.get(user_id)) { 
        var userLocation = userGR.getValue('location');
        if (userLocation == 'Vancouver - Great Northern Way') {
            // Code to display the guide since user location matches
            gs.info('User is in Vancouver - Great Northern Way. Displaying the guide.');
        } else {
            // Code to handle when user location doesn't match
            gs.info('User is not in Vancouver - Great Northern Way. Guide will not be displayed.');
        }
    } else {
        // Code to handle when user record is not found
        gs.info('User record not found with the provided user ID.');
    }

 

 

Please Mark Correct if this solves your query and also mark 👍Helpful if you find my response worthy based on the impact.

 

Thanks