reply emails shall be copied to associated child cases and incidents.

kalakaramad_20
Tera Contributor

I have a requirement that when the client replies to some cases from the email method the reply email must be copied to associated incident.

kalakaramad_20_0-1707910326595.png

The same content email received must be copied to the incident also. Can anyone help ?
Thanks in advance.

21 REPLIES 21

    var inc = parseIncidentNumber(email.body);
    var emailBody = email.body_text;
    var incGR = new GlideRecord('incident');
    if (incGR.get('number', inc)) {
        incGR.comments = "Client reply:\n" + emailBody;
        incGR.update();
        sendEmailToIncident(incGR.sys_id, emailBody);
    } else {
     
        var case_state = current.state;

        if (current.state == 500) {
            var lines = email.body_text.split('\n');
            var firstword = "";

            if (lines.length > 0)
                firstword = lines[0].replace(/^\s+|\s+$/g,'');
           
            firstline = firstword.toLowerCase();
           
            if (firstline) {
                if(firstline.indexOf("reject") == 0)
                    current.state = 2;
                else if(firstline.indexOf("accept") == 0)
                    current.state = 6;  
            }
        }
        if (current.getTableName() == 'sn_customerservice_case') {
                current.comments = current.comments = "reply from: " + email.origemail + "\n\n" + email.body_text;
        }
        else if (current.u_on_hold_reason_1 == 1) {
            current.state = 2;
        }
        else if (current.state == 200) {
            current.state = 2;
        }
        else {
            current.sys_updated_on = "";
        }
        current.update();
    }



What's your question?

 


Please mark any helpful or correct solutions as such. That helps others find their solutions.
Mark

my requirement is to copy reply emails from case to associated incidents as comments.or the whole mail to be copied to incident.

Mark Manders
Mega Patron

Just make sure the content of the email is in the comments/worknotes of the case and copy them from the case to the incident. 


Please mark any helpful or correct solutions as such. That helps others find their solutions.
Mark

It is coming as reply mail in the activity stream , but i want to copy reply email content to incident from case table.