How to link an email to the appropriate incident

sonita
Giga Guru

If the incident is not resolved or not closed, I need to

  1. link the inbound email to the appropriate incident,
  2. Add the reply email (only) to the work-notes within.

Any help would be appreciated.

16 REPLIES 16

This is how i modified some parts, is it correct?



if (current.state != "6" && current.state != "7")//incident not resolved or closed


  {




            //Add the reply email (only) to the work-notes within.



  current.work_notes = "reply from: " + email.origemail + "\n\n" + email.body_text;


  return;


  }


Hi Soni,



if (current.state != "6" && current.state != "7")//incident not resolved or closed


  {


current.work_notes = "reply from: " + email.origemail + "\n\n" + email.body_text;


current.update();


  }



This should work.


Can you paste the whole code here once.


this is what I've done so far:



gs.include('validators');




(function(){


  //var bodyText = email.body_text;




if (current.getTableName() == "incident") {



  if(current.state == "6" || current.state == "7")//incident is not resolved or closed


  {


  gs.eventQueue("Inbound_Email(Incident_resolved)",current,current.caller, gs.getUserID());


  return;


  }


  if (current.state != "6" && current.state != "7")//incident not resolved or closed


  {


  //Link the inbound email to the appropriate incident.



            //Add the reply email (only) to the work-notes within.



  current.work_notes = "reply from: " + email.origemail + "\n\n" + email.body_text;


  current.update();


  }


  if(current.assigned_to !=""){


  gs.eventQueue("Notification to assigned to analyst",current,current.assigned_to, gs.getUserName());}



  else if (current.assigned_to ==""){


  gs.eventQueue("Assign To analyst is blank",current,current.


assignment_group.Incident.Coordinator, gs.getUserName());


  return;}



  //if incident state awaiting / awaiting user info



  if(current.state=="11" && current.u_substate=="4")


  {


  current.state="1";


        current.update();


  return;


  }


  //if task state is response required



  var gr=new GlideRecord('u_inc_task');


  gr.addQuery('response required',true);


  gr.query();


  while (gr.next())


  {


  if(current.state=="-1")


  {


  current.state="1";


                current.update();


        return;


  }


  }


  //If an inbound email is sent to ServiceNow that does not have the proper identification



  var sender=email.from;


  if(sender != undefined)


  {


  gs.eventQueue("No proper identification",current,current.caller, gs.getUserID());


  return;


  }


        //}


}


})();


Hi Soni,



Try to put this in script include and call it from the inbound email action. Put log statement and check which line is causing the issue.


It will give you clear idea.