...
Note |
---|
When creating your new class, you must declare both the class and the method as global so that the CW4SF package can access the class and invoke the method. When you have created your class, you must ensure that CW4SF uses the class. For information on configuring this feature, see Configuring custom settings for advanced optional features. |
CW4SF validates the value returned by the GetPresentedClid method according to the following rules:
...
Expand |
---|
|
Section |
---|
Column |
---|
| In our first example, the presented callback number is stored in and retrieved from a custom field, called ClickToDialPresentedClid, on an Account object. Firstly we created an Account object field called ClickToDialPresentedClid. For information on creating custom fields, about configuring the class that CW4SF uses to select the presented CLID, see Salesforce help. |
Column |
---|
|
|
|
Secondly, we created a new Apex class called SelectPresentedClidForContactByAccount : Code Block |
---|
| global class SelectPresentedClidForContactByAccount implements NVMContactWorld.ISelectPresentedClid{
// The clickToDialResult parameter contains the response string from the Salesforce ClickToDial event.
// Salesforce passes the clickToDialResult parameter to us:
// for example '{number: "07890123456", objectId: "0032000001FTGSo", object: "Contact"}'
// Find more information at: https://www.salesforce.com/us/developer/docs/api_cti/Content/sforce_api_cti_onclicktodial.htm
global String GetPresentedClid(String clickToDialResult){
Map<String,Object> clickToDialResultMap = (Map<String,Object>)JSON.deserializeUntyped(clickToDialResult);
String contactId = (String)clickToDialResultMap.get('objectId');
Contact c = [SELECT Id, AccountId FROM Contact WHERE Id = :contactId];
Account a = [SELECT Id, ClickToDialPresentedClid__c FROM Account WHERE Id = :c.AccountId];
String presentedClid = a.ClickToDialPresentedClid__c;
return presentedClid;
}
} |
When an agent clicks to dial a number in a contact record, CW4SF runs our GetPresentedClid method in the SelectPresentedClidForContactByAccount class, which implements the ISelectPresentedClid interface. The GetPresentedClid method performs the following tasks: - receives the details (
clickToDialResult ) of the Click to dial event - uses the
objectId from clickToDialResult to identify the contact record from which the agent initiated the call - locates the record for the account to which the contact belongs
- returns the number from the custom field (
ClickToDialPresentedClid__c ) on the account record
CW4SF uses the returned number as the callback number. The number appears both in ContactPad and on handset of the person that the agent has clicked to dial. |
...