- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hey All,
I have a quick question. I have a onChange Client Script, that calls a script include with a property function.
Here's the function within the script include:
getPropertyValue : function(){
var property = this.getParameter('sysparm_propertyName');
var propertyValue = gs.getProperty(property);
return propertyValue;
},
type: 'ClientSideUtil'
});
This is the client script, I want to add another sys_property, but I am having an issue that the other property isn't working. Here's the code.
function onChange(control, oldValue, newValue, isLoading) {
// if (isLoading || !newValue) {
// // Clear decorations if the field is empty or loading
// g_form.removeDecoration('caller_id', 'icon');
// g_form.removeDecoration('caller_id', 'text-color');
// return;
// }
g_form.getReference('caller_id', vipCallerCallback);
}
function vipCallerCallback(caller) {
if (!caller)
return;
var ga = new GlideAjax('global.ClientSideUtil');
ga.addParam('sysparm_name', 'getPropertyValue');
ga.addParam('sysparm_propertyName', "Sys_ID.sys_user_group.L2-Field Support");
ga.getXMLAnswer(function(atlantaID) {
// Remove any previous decorations
g_form.removeDecoration('caller_id', 'icon-star', 'Field Support User', "color-green");
g_form.removeDecoration('opened_for', 'icon-star', 'VIP User', 'color-red');
// VIP Status
if (caller.vip == 'true') {
g_form.addDecoration('caller_id', 'icon-star', 'VIP User', 'color-red');
}
// Campus Group + not VIP
if (caller.u_campus_group == atlantaID) {
g_form.addDecoration('caller_id', 'icon-star', 'Field Support User', "color-green");
}
});
var ga2 = new GlideAjax('global.ClientSideUtil');
ga2.addParam('sysparm_name', 'getPropertyValue');
ga2.ga.addParam('sysparm_propertyName', "Sys_ID.sys_user_group.L2-EP-Client Support");
ga2.getXMLAnswer(function(secondGroupID) {
g_form.removeDecoration('caller_id', 'icon-star', 'Field Support User', "color-green");
g_form.removeDecoration('opened_for', 'icon-star', 'VIP User', 'color-red');
if (caller.u_campus_group == secondGroupID) {
g_form.addDecoration('caller_id', 'icon-star', 'EP Client Support', "color-blue");
}
});
}
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi @0890KM
change you code as per below
var ga2 = new GlideAjax('global.ClientSideUtil');
ga2.addParam('sysparm_name', 'getPropertyValue');
ga2.addParam('sysparm_propertyName', "Sys_ID.sys_user_group.L2-EP-Client Support");
ga2.getXMLAnswer(function(secondGroupID) {
g_form.removeDecoration('caller_id', 'icon-star', 'Field Support User', "color-green");
g_form.removeDecoration('opened_for', 'icon-star', 'VIP User', 'color-red');
if (caller.u_campus_group == secondGroupID) {
g_form.addDecoration('caller_id', 'icon-star', 'EP Client Support', "color-blue");
}
});
Thanks
dgarad

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Did you make sure the new property exists and has a value? If so do you have the case correct?
You may want to make this change in your getPropertyValue method
var propertyValue = gs.getProperty(property, "Property not found");
This way if the property does not exist you get something back telling you.
You also may want to consider updating getPropertyValue to allow you to send a comma delimited list of values so you do not have to make multiple calls to the server.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
yes, I created the new property with a value. It throws an error message when I add the new call.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Ok, whats the error message?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago