Add flag next to the user field
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-27-2013 10:40 AM
Hi all,
I'm trying to add a small flag next to user field in the incident form depending on the manufacturer of the computer assigned to him (cmdb_ci table).
I'm trying to do something pretty simple, based on the VIP flag which is shown when a user is marked as VIP.
The difficulty here is that the condition is based on a value from a different table.
Here is the var that should be used => var manufacturerLabel = $('label.cmdb_ci.manufacturer');
but I've tried to change this original (Highlight VIP Caller) Code Snippet without success
================
function onChange(control, oldValue, newValue, isLoading) {
var callerLabel = $('label.incident.caller_id');
var callerField = $('sys_display.incident.caller_id');
if (!callerLabel || !callerField)
return;
if (!newValue) {
callerLabel.setStyle({backgroundImage: ""});
callerField.setStyle({color: ""});
return;
}
g_form.getReference('caller_id', vipCallerCallback);
}
function vipCallerCallback(caller) {
var callerLabel = $('label.incident.caller_id');
var callerField = $('sys_display.incident.caller_id');
if (!callerLabel || !callerField)
return;
//check for VIP status
if (caller.vip == 'true') {
callerLabel.setStyle({backgroundImage: "url(images/icons/vip.gif)", backgroundRepeat: "no-repeat", backgroundPosition: "95% 55%"});
callerField.setStyle({color: "red"});
} else {
callerLabel.setStyle({backgroundImage: ""});
callerField.setStyle({color: ""});
}
}
================
Does anyone knows a workaround to do this ?
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-30-2013 07:30 AM
Hello,
Just chasing this request.
😕
thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-30-2013 08:14 AM
So what is it you are trying to do? Show different images based on the manufacturer, or show an image if it is a particular manufacturer.
Basically, you are going to want to use a GlideAjax call to pass along the user and have the server side code lookup the primary equipment's manufacturer and pass back some result to the client script so it can do what you need it to.
Also, you will want to use a Display Business Rule when loading an existing record so you do not have to make a call back to the server. So when loading a record, the client script would read the content of the scratchpad instead of making the GlideAjax call. It's just more efficient this way.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-30-2013 09:04 AM
What I'm trying to do excatly:
- I open an new incident
- I select a caller
- if this user has several equipments assigned to him, we only check the "primary" equipment
- if the "primary" equipment has particular manufacturer (for example Apple)
- I receive an alert or information message telling that this user has an Apple device.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-30-2013 08:23 AM
The answer in this post may give you a push in the right direction:
Set Assignment Group based on Configuration Item
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-06-2013 11:33 PM
Were you able to accomplish what you needed?