2

An Operator is chatting with a client, Alfredo. In order to be contacted again by the same user the Operator needs to pass his ID throught the chat.

If he simply passes his ID

http://site-visible-externally/VF-PageReconnecting?UserId-passed-throught-URL=00525000000DxSQ

it works. Clicking on this link Alfredo can reconnect with the same Operator when he wants (and when that operator is onLine). Obviously we have a certain number of Operators.

A possible solution is to create a link for each Operator putting the related Id.

What I want, instead, is to pass the Id directly in the ULR such that it works for every user. Something like:

http://site-visible-externally/VF-PageReconnecting?UserId-passed-throught-URL={!$User.Id}

Ideally, when the operator writes this code the part {! $User.Id} should be filled with his own Id. Is that possible?

This is the VF-PageReconnecting:

<apex:page docType="html-5.0" showHeader="false"  cache="true" controller="VF-PageReconnecting-Controller" >  


<head>Redirecting Page...</head>

<script type='text/javascript' src='https://c.la1-c1cs-lon.salesforceliveagent.com/content/g/js/34.0/deployment.js'></script>
<script>   

    //---------------------------------------------------------------
    var ourTimeStamp = new Date().getTime();
    liveagent.addCustomDetail("IdAOL", ourTimeStamp);

    //liveagent.addCustomDetail("IdAOL", new Date().getTime());
    liveagent.findOrCreate("Info__c").map("ID_AOL__c", "IdAOL", false, false,true);
    liveagent.findOrCreate("Info__c").showOnCreate();
    liveagent.findOrCreate("Info__c").saveToTranscript("Info__c","Info__c");
    liveagent.findOrCreate("Survey_Operatore__c").map("ID_AOL__c", "IdAOL", false, false,true);
    liveagent.findOrCreate("Survey_Operatore__c").showOnCreate();       
    liveagent.findOrCreate("Survey_Operatore__c").saveToTranscript("Survey_Operatore__c","Survey_Operatore__c");



    liveagent.init('https://d.la1-c1cs-lon.salesforceliveagent.com/chat', '572250000019OOV', '00D250000ANdrEA');
    //-------------------------------------------------------------------
    // Start Chat

     setTimeout(function(){ 
        liveagent.startChatWithWindow('573250000008OOO', 'window', '{! idUtente}', true); 
     },2000); 

    // Javascript URL redirection
    window.location.replace("http://andreaianni.branded.me/");

</script> 

</apex:page>

This is the related Controller:

public without sharing class VF-PageReconnecting-Controller {

  public String idUtente {get; set;} 
  // 
  public VF-PageReconnecting-Controller (){
    idUtente = '0';
    // I take the id passed by URL
    idUtente = ApexPages.currentPage().getParameters().get('UserId-passed-throught-URL');
  }

}
0

Have you considered using startChatWithWindow and pass the User Id reference before the chat start. Instead of passing the agent Id if the chat is authenticated (or you create contact out of it) you can save the agent Id on the contact record and try to assign the same agent to the chat.

This keeps your logic and data hidden from external users.

| improve this answer | |
  • I'm already using the Chat With Window. in fact, in the startChatWithWindow I pass the {! idUtente} that I take directly from the link that the Operator passed to Alfredo. The problem is: how can I pass that User.Id from the Live Agent Console? – Andrea Ianni ௫ Aug 31 '15 at 10:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.