14 |
15 |
--------------------------------------------------------------------------------
/Live-Agent/deployment-API/deployment-code.js:
--------------------------------------------------------------------------------
1 | //get the user's email address from local storage
2 | var email = localStorage.getItem('liveAgentEmail');
3 | //add a custom detail named email using the email variable
4 | liveagent.addCustomDetail('email',email);
5 | //add two other custom details for case subject and case status
6 | liveagent.addCustomDetail('caseStatus','New');
7 | liveagent.addCustomDetail('caseSubject','Portal Case: ');
8 | //we will find or create a contact record
9 | liveagent.findOrCreate('Contact');
10 | //find a contact where the email address matches the value
11 | //of the customDetail named email, do not perform exact match
12 | //and do not create a new contact
13 | liveagent.findOrCreate('Contact').map('email','email',true,false,false);
14 | //once the contact is found add it to the contact lookup on the chat transcript record
15 | liveagent.findOrCreate('Contact').saveToTranscript('Contact');
16 | //link the contact to a new case by the contactId lookup field
17 | liveagent.findOrCreate('Contact').linkToEntity('Case','ContactId');
18 | //find or create a new case
19 | liveagent.findOrCreate('Case');
20 | //create a new case and populate the status and subject fields using the customDetails
21 | liveagent.findOrCreate('Case').map('Status','caseStatus',false,false,true).map('Subject','caseSubject');
22 | //once the case is created display it in the console
23 | liveagent.findOrCreate('Case').showOnCreate();
24 | //attach the case to the transcript via the case lookup field
25 | liveagent.findOrCreate('Case').saveToTranscript('CaseId');
26 |
--------------------------------------------------------------------------------
/Live-Agent/deployment-API/login.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |