Gurpreet07
Mega Sage

Okay,   we were checking for from address but you mentioned that assignment should be on basis of To Address. Following code should work.



  1. // Define Caller Details
  2. var callerID = gs.getUser().getRecord();
  3. var sEmailAddress = email.direct.toLowerCase();
  4.   if (sEmailAddress.indexOf("ithelpdesk@conns.com") != -1) {
  5.   current.assignment_group.setDisplayValue("IT Helpdesk");
  6.   }
  7. else if(sEmailAddress.indexOf("security@conns.com") != -1){
  8. current.assignment_group.setDisplayValue("IT Securities");
  9. }
  10. current.caller_id = callerID.getValue('sys_id');
  11. current.location = callerID.getValue('location');
  12. current.u_phone_number = callerID.getValue('phone');
  13. current.contact_type = 'email';
  14.  
  15. // Define Incident Details
  16. current.status = 1;
  17. current.short_description = email.subject;
  18. current.description = email.body_text;
  19. current.insert();

View solution in original post