Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Note
titleConfigure custom settings

When you have created your class, ensure that ContactWorld uses the class in Salesforce. For information about configuring the class that ContactWorld uses to select the presented CLID, see Configuring custom settings for optional NewVoiceMedia Vonage Contact Center features in Salesforce.

You can create different Apex classes to define callback behaviors for different departments and users. Define the required class for specific profiles or users in hierachical custom settings.

...

  • if a null value is returned, the Click to dial call continues and ContactWorld uses the agent's default callback number, if set, or the account's default callback number
  • if a non-null value is returned but the value is not configured as a callback number for the account, the agent receives an error message
  • if a non-null value is returned and the value is configured as a callback number for the account, but that callback number is restricted from the agent, the agent receives an error message
  • if a non-null value is returned and if the value is configured as a callback number for the account and that callback number is not restricted from the agent, the Click to dial call continues, and the value is used as the callback number for the call
60%Presented CLID field createImage RemovedPresented CLID readImage Removed

Secondly, we created a new Apex class called SelectPresentedClidForContactByAccount:

Expand
titleExample 1
Section
Column
width

In our first example,

 the

 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 about creating custom fields, see Salesforce help.

Column
width40%
Code Block
languagejava
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, ContactWorld 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

ContactWorld 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.

...