- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-18-2017 05:46 AM
Using the UI Action of "Create Incident" I'm trying to add a script so that it will log the incident number into the work notes from
the previous incident. I've tried all different scripts and nothing is working for me. Here is the current script I've put in and nothing in the work notes.
current.work_notes.setJournalEntery('number');
Here is the full script in "Create Incident" UI action....
var inc = new GlideRecord("incident");
inc.company = current.company;
inc.location = current.location;
inc.caller_id = current.caller_id;
inc.u_affected_user = current.u_affected_user;
inc.u_phone = current.u_phone;
inc.contact_type = current.contact_type;
inc.short_description = current.short_description;
inc.description = current.description;
inc.category = current.category;
inc.subcategory = current.subcategory;
current.work_notes.setJournalEntery('number');
var sysID = inc.insert();
var mySysID = current.update();
gs.addInfoMessage("Incident " + inc.number + " created");
action.setRedirectURL(inc);
action.setReturnURL(current);
Any assistance would be appreciated. Thanks.
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-18-2017 05:59 AM
I've got it working now, when creating a new incident off of an older incident I added this into my script;
inc.work_notes = ("Ref #" + current.number);
now its working the way I was expecting. Thank you all for your assistance.
Here is the final code.
var inc = new GlideRecord("incident");
inc.company = current.company;
inc.location = current.location;
inc.caller_id = current.caller_id;
inc.u_affected_user = current.u_affected_user;
inc.u_phone = current.u_phone;
inc.contact_type = current.contact_type;
inc.short_description = current.short_description;
inc.description = current.description;
inc.category = current.category;
inc.subcategory = current.subcategory;
inc.work_notes = ("Ref #" + current.number); //here is the new entry that puts the previous incident number into the new ticket
var sysID = inc.insert();
var mySysID = current.update();
gs.addInfoMessage("Incident " + inc.number + " created");
action.setRedirectURL(inc);
action.setReturnURL(current);

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-18-2017 05:48 AM
Hi Tom,
Have you tried a straight forward:
current.work_notes = 'number';
???
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-18-2017 05:50 AM
Yes, it still doesn't put the last incident number into the work notes.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-18-2017 05:51 AM
Try: current.work_notes.setJournalEntery(inc.getDisplayValue('number'));
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-18-2017 05:59 AM
I've got it working now, when creating a new incident off of an older incident I added this into my script;
inc.work_notes = ("Ref #" + current.number);
now its working the way I was expecting. Thank you all for your assistance.
Here is the final code.
var inc = new GlideRecord("incident");
inc.company = current.company;
inc.location = current.location;
inc.caller_id = current.caller_id;
inc.u_affected_user = current.u_affected_user;
inc.u_phone = current.u_phone;
inc.contact_type = current.contact_type;
inc.short_description = current.short_description;
inc.description = current.description;
inc.category = current.category;
inc.subcategory = current.subcategory;
inc.work_notes = ("Ref #" + current.number); //here is the new entry that puts the previous incident number into the new ticket
var sysID = inc.insert();
var mySysID = current.update();
gs.addInfoMessage("Incident " + inc.number + " created");
action.setRedirectURL(inc);
action.setReturnURL(current);