How to copy incident using UI action

Learn SN
Tera Contributor

How do I copy the incident using UI action ? 

1 ACCEPTED SOLUTION

asifnoor
Kilo Patron

Hi,

Create an UI action and in the script, you can write something like below

var inci = new GlideRecord('incident');
inci.initialize();
inci.short_description = current.short_description;
//do this for other fields.
//if you want to copy work notes and comments, then you can try this
inci.work_notes = current.work_notes.getJournalEntry(-1);
inci.comments = current.comments.getJournalEntry(-1);

inci.insert();
action.setRedirectURL(inci);

View solution in original post

4 REPLIES 4

asifnoor
Kilo Patron

Hi,

Create an UI action and in the script, you can write something like below

var inci = new GlideRecord('incident');
inci.initialize();
inci.short_description = current.short_description;
//do this for other fields.
//if you want to copy work notes and comments, then you can try this
inci.work_notes = current.work_notes.getJournalEntry(-1);
inci.comments = current.comments.getJournalEntry(-1);

inci.insert();
action.setRedirectURL(inci);

Devyani_6
Mega Guru

Hi,

Go through below thread, this will helps you.

UI Action copy incident

Mark Correct/Helpful, if this helps you.

Regards,

Devyani

Ian Mildon
Tera Guru

There is an OOB UI Action to Copy Incident. And the nice thing with the OOB one, it creates a new record but does not submit it, so you can fill out any needed mandatory fields before manually clicking Submit. Most custom UI Actions automatically submit the new record with fields left blank.