UI Action through Insert and Stay

JW22
Tera Contributor

Hello All,

 

I've created an Insert and Stay function that was missing for one of our incident tables via a UI Action (see below). Essentially this will enable our users to duplicate incidents. I'd like to pass through the original case number into the comments, does anyone know if this is possible?

 

if (typeof current.number != 'undefined' && current.number)
current.number = ""; // generate a new incident number
current.state = 1;
current.comments = "Incident duplicated from " // I'd like to pass through the old incident number here
current.insert();
action.setRedirectURL(current);
 
Thank you!
1 ACCEPTED SOLUTION

BalaG
Kilo Sage

Hi @JW22   have you tried  moving the incident.number to the bottom of the script. Here is the modified script

 

if (typeof current.number != 'undefined' && current.number) {
    current.state = 1;
    current.comments = "Incident duplicated from " + current.number // Add incident incident number here
    current.number = ""; // generate a new incident number
    current.insert();
    action.setRedirectURL(current);
}

View solution in original post

2 REPLIES 2

BalaG
Kilo Sage

Hi @JW22   have you tried  moving the incident.number to the bottom of the script. Here is the modified script

 

if (typeof current.number != 'undefined' && current.number) {
    current.state = 1;
    current.comments = "Incident duplicated from " + current.number // Add incident incident number here
    current.number = ""; // generate a new incident number
    current.insert();
    action.setRedirectURL(current);
}

JW22
Tera Contributor

Thank you very much, this worked! I appreciate it.