- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-20-2022 08:29 AM - edited ‎10-20-2022 08:53 AM
Hi All,
I want to get the Location field and copy in work notes on incident form . I know I can write with BR. but I would like to write with Script include. I wrote the this script include and BR. but it does not work. can you help me please .
Script Include:
*************************************************
var UpdateWorkNotes = Class.create();
UpdateWorkNotes.prototype = {
initialize: function() {
},
location: function(usr){
var Gruser = new GlideRecord ('sys_user');
Gruser.addQuery('sys_id',usr);
Gruser.query();
if (Gruser.next()){
var location = Gruser.location.name.toString();
gs.log("user location" + location, "test");
return location;
}
},
type: 'UpdateWorkNotes'
};
********************************************************
BR: before insert or update
var x = new UpdateWorkNotes(); //call script include
var location = x.location(current.caller_id.toString()); // set location
current.setValue('work_notes', location);
})(current, previous);
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-20-2022 09:04 AM - edited ‎10-31-2022 07:46 AM
You can simplify things instead of using a script include just use:
current.work_notes = current.location.getDisplayValue();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-20-2022 09:04 AM - edited ‎10-31-2022 07:46 AM
You can simplify things instead of using a script include just use:
current.work_notes = current.location.getDisplayValue();