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-27-2013 12:57 PM
Unlike the VIP flag, a user may be assigned to multiple computers. How do you want to handle that scenario? Show the flag if any of the computers is of a certain manufacturer?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-27-2013 01:20 PM
Hello Jim,
In fact you're right, a user can be assigned multiple computers.
In my case, we can imagine a simple status field for the equipment with primary, secondary... values
and my condition need to match that computer must be a primary equipment.
Hope I'm clear
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-28-2013 01:10 AM
Does someone knows how it is possible to do that please ?
Thanks in advance
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-29-2013 06:05 AM
Hello all,
Is what I'm asking impossible to do ?
Thanks for any help