- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-04-2014 01:08 PM
Hey Guys I am attempting to rewrite the label if a user has itil role..
however I believe the syntax maybe off.. can you help?
the field name is called u_comments
function onLoad() {
if (!g_user.hasRole("itil"))
return;
var field = 'u_comments';
var fieldFormName = g_form.getTableName() + "." + field;
var fieldLabelName = "label." + fieldFormName;
var ctrl = $(fieldLabelName);
if (!ctrl)
return;
var label = ctrl.select('label')[0];
if (!label)
return;
var s = label.innerHTML;
label.innerHTML = s.substring(0, s.length — 1) + ' (' + getMessage('Customer visible') + '):';
//label.setStyle({fontWeight:"bold"});
}
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-04-2014 02:27 PM
Mark Stanger (Crossfuze) Resolved this for me
function onLoad() {
if(!g_user.hasRole('itil'))
return;
//Change the description label to 'My New Label' with bold red text
changeFieldLabel('u_comments', 'My New Label', 'red', 'bold');
}
function changeFieldLabel(field, label, color, weight){
try{
var labelElement = $('label.' + g_form.getControl(field).id);
labelElement.select('label').each(function(elmt) {
elmt.innerHTML = label + ':';
});
if(color)
labelElement.style.color = color;
if(weight)
labelElement.style.fontWeight = weight;
}catch(e){};
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-01-2017 05:40 AM
Thanks Chuck ,
I will search for another alternative as this is a project requirement.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-01-2017 05:57 AM
Aastha,
Sometimes you need to push back on requirements when you recognize risk is involved. Let the decision makers determine whether the cost of implementing a customized solution that carries risk of upgrade issues is worth it. They would rather know this now and decide that a few colors are not worth it than find out later and you get blamed for having known this information and not sharing it. Be sure the risk and documented decision is documented somewhere also.
(30+ years of IT has taught me a few lessons.)