How to access a table values on a Catalog Client Script?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-20-2018 05:35 AM
Hi All,
I am modifying an OOB Record Producer 'Create Incident' in which end user can create an incident through Portal. In this, I'm trying to check if the current user is a VIP User or not. If the user is a VIP user, then the Urgency variable present in the Record Producer should be auto-populated with a certain value.
Here is the code that I am using:
function onLoad() {
//Type appropriate comment here, and begin script below
var currentUser=new GlideRecord('sys_user');
currentUser.addQuery('user_name',g_user.userID);
currentUser.query();
var vipStatus;
var vvipStatus;
if(currentUser.hasNext()){
g_form.addInfoMessage("inside if");
vipStatus=currentUser.vip;
vvipStatus=currentUser.u_vvip;
}
if(vipStatus=="true"){
g_form.setValue('urgency',7,'VIP');
g_form.setReadOnly('urgency',true);
}
if(vvipStatus=="true"){
g_form.setValue('urgency',7,'VIP');
g_form.setReadOnly('urgency',true);
}
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-20-2018 06:26 AM
Change value from currentUser.addQuery('user_name',g_user.userID); to currentUser.addQuery('sys_id',g_user.userID);