Create a new request when user replies to a closed ticket

cp10
Tera Contributor

Hi Team, 

I have a requirement to create a new ticket when ever user replies to a closed ticket. I have done the coding part and  tested and its creating new request(ex-RITM00978) successfully. After I tried to send an email to update the new ticket (RITM00978) but its creating new request again instead of update new ticket (RITM00978). could you please let me know how to fix this issue.

Inbound Action Code:

 

gs.include('validators');

if (current.getTableName() == "sc_req_item") {
    //updated the if condition to check the reply link functionality with---  or condition' in if block
    if ((current.active && current.state != '15') || (current.active && email.subject.contains('Response'))) {

        current.comments = "reply from: " + email.origemail + "\n\n" + email.body_text;
        current.state = '9';
        current.u_email_update = true;
    } else if (current.active && current.state == '15' && email.subject.contains('Reopen')) {

        current.comments = "Ticket Reopened with following reply from: " + email.origemail + "\n\n" + email.body_text;
        current.state = '2';
        current.u_email_update = true;

    } else if (current.active == false ) {
        var gr = new GlideRecord('sc_req_item');
        gr.initialize();
        gr.u_requested_for = email.from.toString();
        gr.assignment_group = current.assignment_group;
        gr.u_description_html = email.body_html;
        gr.description = email.body_text;
        gr.cat_item = current.cat_item;
        gr.short_description = email.subject;
        gr.u_type = current.u_type;
        gr.contact_type = current.contact_type;
        gr.location = current.location;
        gr.insert();
    }
    current.update();
 }

 

 

 

0 REPLIES 0