Use > Service Manager Collaboration > End User Chat > End User Chat administrator tasks > Customize the chat request preview information

Customize the chat request preview information

When you hover your mouse over the More button of a chat request in the chat request panel, the system display some preview information of the chat request. By default, these information includes department, email, location, and the end user's issue description. See the following screenshot as an example:

As a Service Manager system administrator, you can use the Script Library to update the JavaScripts and define the preview information of a chat request. To customize the chat request preview information in the chat request panel, follow these steps:

  1. Log on to Service Manager as a system administrator.

  2. Click Tailoring > Script Library.
  3. Open the EndUserChatCustomization JavaScript in the Script Library, and then locate the function overrideChatRequestInfo(chatReqId,chatReqTableName) script. The out-of-box script is as follows:

    function overrideChatRequestInfo(chatReqId,chatReqTableName){
        /*
        //Below is an example
        var chat=new SCFile(chatReqTableName,SCFILE_READONLY);
        var sql="number=\""+chatReqId+"\"";
        if(chat.doSelect(sql)===RC_SUCCESS){
            var contact=lib.EndUserChat.getContactByName(chat['contact']);
            var rtn=[];
            rtn.push({"label":lib.EndUserChat.getFieldLocalizedCaption("company", "contacts"),"value":contact['company']});
            rtn.push({"label":lib.EndUserChat.getFieldLocalizedCaption("dept.name", "contacts"),"value":contact['dept.name']});
            rtn.push({"label":lib.EndUserChat.getFieldLocalizedCaption("email", "contacts"),"value":contact['email']});
            rtn.push({"label":lib.EndUserChat.getFieldLocalizedCaption("location", "contacts"),"value":contact['location']});
            rtn.push({"label":lib.EndUserChat.getFieldLocalizedCaption("description", chatReqTableName),"value":chat['description']});
            return rtn;
        }
        else return null;
        */
        return null;
    }
  4. Update the script to suit your business needs. See the following sample script for detailed descriptions for this function:

    /**
    * This function is left to customers to customize the chat request info which is displayed when accepting a chat request, system will display 
     * OOB default configuration (Department, Email, Location, and Description of the Service Portal user's issue) if this function returns null
    * @param chatReqId (String)
    *          The chat request ticket id, it will be passed in automatically
    * @param chatReqTableName (String)
    *          The chat request dbdict name, it will be passed in automatically
    * @return [
    *             {"label":"Company","value":"advantage"},
    *             {"label":"Dept Name","value":"North America - HR & Administration"},
    *             {"label":"Email","value":"user@microfocus.com"},
    *             {"label":"Location","value":"BLDG1"},
    *             {"label":"Description","value":"Can not connect to email server"}            
     *          ]
    */
    

    Note The system displays the default configuration (Department, Email, Location, and Description of the Service Portal user's issue) when the function returns null.

  5. Click Save and OK.