Adding a signature on worknotes
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-26-2011 10:38 AM
So I had a user ask me about having an automatic signature added on work notes.
I created a signature field on the user record. Then I created a client script(may not be perfect, but it works):
function onLoad() {
//Add a UI macro to a non-reference field
//Set the name of the field in the 'field' variable
var field = document.getElementById('label.incident.work_notes');
//document.getElementById('lablel.incident.work_notes.make_spacing_ok').style.display='none';
try{
//Create the image element and add to the dom
var img = document.createElement('img');
img.src = "images/icons/scripts.gifx";
img.alt="Add Signature";
img.title="Add Signature";
var link = document.createElement('a');
if (navigator.appName == "Microsoft Internet Explorer"){
link.setAttribute('onclick', Function('doSomething()'));
}
else{
link.setAttribute('onclick', 'doSomething()');
}
link.name="signatures";
link.id="signature";
link.appendChild(img);
//field.parentNode.appendChild(link);
field.appendChild(link);
}
catch(e){
//alert('Error');
}
}
//onclick event to fire when the image is clicked
function doSomething() {
var userID = g_user.userID;
var signature ='';
var curNotes = g_form.getValue('work_notes');
var userRec = new GlideRecord('sys_user');
userRec.addQuery('sys_id',userID);
userRec.query();
if(userRec.next()){
signature = userRec.u_signature
}
var signature2='';
signature2 += curNotes+'\n'+'\n'+signature;
g_form.setValue('work_notes',signature2);
}
5 REPLIES 5
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-26-2011 01:52 PM
Ahhh I see! I made an assumption on the BR solution. I just tried the display BR and it works great!
Thanks!