- 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 06:17 AM
Hey Tom,
Thanks for the update. I'm glad you got it taken care of and sharing your approach.
Can you mark your answer as correct so that others with the same question in the future can find it quickly and that it gets removed from the Unanswered list.
If you are viewing this from the community inbox you will not see the correct answer button. If so, please review How to Mark Answers Correct From Inbox View.
Thank you