Configuring disposition codes for Vonage Contact Center in Salesforce

When an agent makes or receives an interaction using Vonage Contact Center, the agent can set a disposition code associated with that interaction. For more information about disposition codes, see Disposition codes for Vonage Contact Center in Salesforce.

You have three different ways to configure disposition codes:

  • Configuring disposition codes using Log a Call
  • Configuring setting the disposition code for an interaction based on the interaction's outcome
  • Configuring disposition codes using custom components and Apex
In this page

1. Configuring disposition codes using Log a Call

Voice interactions only

Agents can set a disposition code using the Salesforce Log a Call area for voice interactions only.

If your agents use Log a Call to add notes and other details during a voice interaction, you can configure disposition codes in the Log a Call area. If your agents do not use Log a Call, you can still configure disposition codes using custom components and Apex. For information about configuring disposition codes using custom components and Apex, see Configuring disposition codes using custom components and Apex section later in this page.

How do I enable agents to select a disposition code for a voice interaction using Log a Call?

Before an agent can select a disposition code for a voice interaction, you must create a disposition code field (or use an existing field) and make the field available in the Log a Call area in applicable Salesforce objects.

To add the disposition code field to the Log a Call area, type the field's API name into the Log A Call Additional Fields field. For more information about adding fields to the Log a Call area, see Customizing the Log a Call area.

An agent can now see and use the disposition code field in the Log a Call area. For information about setting the disposition code, see Setting disposition codes for Vonage Contact Center in Salesforce.

How can I ensure that Salesforce notifies Vonage Contact Center whether an agent has provided a disposition code?

If the enforced disposition codes feature is enabled for your account, you must first configure the feature in Vonage Contact Center. For information about configuring the enforced disposition codes feature in Vonage Contact Center, see Configuring enforced disposition codes. You must then configure Salesforce to notify Vonage Contact Center whether an agent has provided a disposition code.

To configure Salesforce to notify Vonage Contact Center whether the agent has provided a disposition code, add the following information to custom settings:

Custom Settings fieldDescriptionExample
Log a Call Disposition Code Field

The disposition code field's API name.

You must have added the disposition code field to the Log a Call area as described in the previous section.

Disposition_code__c
ContactWorld Account Key

Your Vonage Contact Center account key.

You must also set your API token for the account key. For information about setting your API token, see Configuring Vonage Contact Center API authentication tokens.

You may have already added this information to configure another feature.

polik21xpsu

For information about editing custom settings, see Configuring custom settings for optional Vonage Contact Center features in Salesforce.

When an agent clicks to save their changes in Log a Call, Salesforce notifies Vonage Contact Center whether the agent has provided a value in the specified disposition code field.

2. Configuring setting the disposition code for a voice interaction based on the interaction's outcome

If enabled for your account, you can configure Vonage Contact Center in Salesforce to automatically set the disposition code for an outbound voice interaction based on what happened to the interaction. To configure this feature, you must map interaction outcomes to disposition codes.

For information about call outcomes, see Call outcomes.

To map call outcomes to disposition codes, perform the following steps:

  1. Go to the Disposition Code Management tab.
    The Disposition Codes section contains any existing mappings, and the Assistant section contains the unmapped call outcomes and disposition codes.

  2. Create a new or edit an existing disposition code.
    • To edit an existing disposition code, click the dropdown menu in the last column alongside the disposition code and click Edit.
    • To create a new disposition code, click New.
    Edit Disposition Code appears.
  3. If you are creating a new disposition-code mapping, type the name of the disposition code you want to map in the Disposition Code field, for example, No Answer.

    Maximum length of disposition codes

    Disposition codes should be no longer than the character limit for custom settings. The limit depends on whether the custom settings are encoded or whether the disposition code contains extended characters, such as é.

    We recommend that your disposition codes contain 25 characters or fewer.

    Select the check box alongside the name or names of the call outcome or outcomes you want to map to the disposition code, for example, No Answer and NumberUnobtainable. If the check box is unavailable, the call outcome has already been mapped to a disposition code.

  4. Click Save.
    The mapping appears in the Disposition Codes section; the mapped disposition code and call outcomes no longer appear in the Assistant section.

Using the examples above, if a voice call ends with either NoAnswer or NumberUnobtainable, the disposition code for the call is automatically set to No Answer.

To delete an existing mapping, click the dropdown menu in the last column alongside the mapping and click Delete.

Back to top ↑

3. Configuring disposition codes using custom components and Apex

If the enforced disposition codes feature is enabled for your account and your agents use custom components during an interaction rather than Log a Call, you can configure the custom component to set disposition codes as required.

How do I configure a custom component to set a disposition code for an interaction in Vonage Contact Center?

To configure the custom component to set disposition codes, call the SetDispositionCodeForCurrentCall method in the DispositionCodeService class provided in the Vonage Contact Center package. Use the following Apex code in your component:

Code for configuring disposition codes in custom component

NVMContactWorld.DispositionCodeService dispositionCodeService = new NVMContactWorld.DispositionCodeService(); dispositionCodeService.SetDispositionCodeForCurrentCall('DISPOSITION_CODE_VALUE');

Change DISPOSITION_CODE_VALUE as required.

When your custom component runs the configured Apex code, the DispositionCodeService sets the disposition code for the interaction in Vonage Contact Center.

Visualforce example

You can use the DispositionCodeService Visualforce or Lightning @AuraEnabled methods.

 Visualforce example

The following example is for a Visualforce page with a drop-down menu and a button to set the disposition code for the current user:

Visualforce controller
public with sharing class SampleDispositionController {
 
    public String dispositionCode { get; set; }
     
    public PageReference DispositionCall() {
         
        System.debug('Code: ' + dispositionCode);
        NVMContactWorld.DispositionCodeService dispositionCodeService = new NVMContactWorld.DispositionCodeService();
        dispositionCodeService.SetDispositionCodeForCurrentCall(dispositionCode);
         
        return null;
    }
}
Visualforce page
<apex:page controller="SampleDispositionController">
    <apex:form >
        <apex:selectList multiselect="false" size="1" value="{!dispositionCode}">
            <apex:selectOption itemLabel="Call back in 7 days" itemValue="CallBack" />
            <apex:selectOption itemLabel="Do not contact" itemValue="DoNotContact" />
        </apex:selectList>
        <apex:commandButton value="Disposition Call" action="{!DispositionCall}"/>
    </apex:form>
</apex:page>

Flows example

You can use the DispositionCodeService in a Flow.

 Flows example

To use the DispositionCodeService in a Flow, wrap the code inside a custom class that is an @InvocableMethod:

DispositionCodeService in @InvocableMethod wrapper
global class DispositionFlow {
     
    @InvocableMethod (label = 'Set Disposition Code for Current Call' description = 'Set the disposition code for the users current call in Vonage Contact Center.')
    global static void SetDispositionCode(List<String> params) {
         
        if (params.size() != 1) {
            // Error?
            System.debug('You should pass only 1 disposition code to this method.');
        }
         
        String dispositionCode = params[0];
 
        NVMContactWorld.DispositionCodeService dispositionCodeService = new NVMContactWorld.DispositionCodeService();
        dispositionCodeService.SetDispositionCodeForCurrentCall(dispositionCode);
         
    }
}

When you have created the Apex class, use the Flow Builder to create a flow that uses the class:

  1. Add an Apex Action to your flow.
  2. Choose the Apex class you created.
  3. In Set Input Values, click to include input values.
  4. Type the value or search for resources to set the disposition code to and click Done.

DML statements, asynchronous Apex, scheduled Apex, sending email

The SetDispositionCodeForCurrentCall method makes HTTP callouts to Vonage Contact Center, so you cannot run DML statements, asynchronous Apex (such as future methods and batch Apex jobs), or scheduled Apex, or send email before calling this code. For further information, see Salesforce help.

If you need to perform any such tasks before calling the SetDispositionCodeForCurrentCall method, wrap the call in a future method. For information about future methods and Salesforce limits with future methods, see Salesforce help.

 Example of SetDispositionCodeForCurrentCall within a future method
DispositionCodeService in a future wrapper
public class DispositionCodeServiceFutureWrapper
{
    @future(callout=true)
    public static void SetDispositionCodeForCurrentCallInFuture(String dispositionCode)
    {  
         NVMContactWorld.DispositionCodeService dispositionCodeService = new NVMContactWorld.DispositionCodeService();
         dispositionCodeService.SetDispositionCodeForCurrentCall(dispositionCode);
    }
}
Code that makes call to SetDispositionCodeForCurrentCallInFuture method
public class YourCode
{
    public void YourMethod()
    {
        // --EXAMPLE-- DML statement require before callout
        Example__c obj = new Example__c(Name = 'Test');
        insert obj;
 
        // Call to @future method, which will then callout to Vonage Contact Center
        DispositionCodeServiceFutureWrapper.SetDispositionCodeForCurrentCallInFuture('DISPOSITION_CODE_VALUE');
    }
}

How do I display the disposition code in the interaction's task record in Salesforce?

You can optionally display the disposition code's value in the related interaction's task record.

To display the disposition code in the task record, you must first specify, in custom settings, the field that will contain the disposition code. You can use the standard Call Result (CallDisposition) task field or create a custom field for this purpose. For information about editing custom settings, see Configuring custom settings for optional Vonage Contact Center features in Salesforce.

When your custom component runs the configured Apex code, the DispositionCodeService sets the specified field's value to the value represented by DISPOSITION_CODE_VALUE in the code.

Next, you must add the field to the task's page layout.

Back to top ↑

Support and documentation feedback

For general assistance, please contact Customer Support.

For help using this documentation, please send an email to docs_feedback@vonage.com. We're happy to hear from you. Your contribution helps everyone at Vonage! Please include the name of the page in your email.