Chat Incident Auto Populate

ctsmith
Mega Sage

When an incident is created from chat, it does not auto populate the first name, middle name, and last name (it only populates the caller_id) of an incident as it normally would when an incident is created by other means aside from a chat session.   It seems g_chat is limited in what it can do.   Is there a way to add the first/middle/last names from the chat action for creating an incident from chat?

Thanks!

Chris

1 ACCEPTED SOLUTION

This was able to pull out the necessary information just by querying on the sys_user table:



var chatinfo = new GlideRecord ("sys_user");


  chatinfo.get(g_chat.getChatQueueUser());




g_chat.fire(LiveEvents.WINDOW_CREATE_DOCUMENT,


  'incident',


  {


      caller_id : g_chat.getChatQueueUser(),


      short_description: g_chat.getProperty('short_description'),


      u_reported_source: 'Chat',


  state: '2',


  incident_state: '0',


  u_email_address: chatinfo.email,


  u_phone_number: chatinfo.phone,


  u_incident_location: chatinfo.location


}


);


View solution in original post

18 REPLIES 18

kennetholesco
Mega Expert

Hi ctmath2,



This is for Connect Chat.



After patch, auto-populate of location and assignment group has been removed/not working.



Here's the code I found



response.newRecord("incident",{
  short_description
: conversation.document.short_description ||"",
  caller_id
: conversation.document.opened_by


});



To give you a better idea, here's a screenshot



find_real_file.png



find_real_file.png


That's an out of the box Connect Action.   Are y'all using Connect or Legacy Chat?   If you type in chat in lefthand navigation, do you see actions module?


I believe we are using the Connect Chat. here's what i see in the lefthand navigation.ctmath2



find_real_file.png


How about modifying the script you have a screenshot above to:



response.newRecord("incident", {


short_description: conversation.document.short_description || "",


caller_id: conversation.document.opened_by,


location: getLocation(conversation.document.opened_by)


});


function getLocation(user){


var myUserObject = gs.getUser();


myUserObject=myUserObject.getUserByID(user);


return myUserObject.getLocation();


}


Hi Chris,



I appreciate your help on this. I was able to solve this with your guidance. See my script below:




response.newRecord("incident", {


                          short_description: conversation.document.short_description || "",


                          caller_id: conversation.document.opened_by,


                          contact_type : 'Chat',


                          assignment_group : 'a0c65f886f0ed200cc1d6592be3ee422',


                          location: conversation.document.opened_by.location


});