Versions Compared

Key

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

When an agent makes a call using NewVoiceMedia, the agent can set a disposition code associated with that call. For more information about disposition codes, see Disposition codes for NewVoiceMedia in Salesforce.

You have three different ways to configure disposition codes:

  • Configuring disposition codes using Log a Call
  • Configuring setting the disposition code for a call based on the call's outcome
  • Configuring disposition codes using custom components and Apex
Panel
borderColor#eeeeee
bgColorwhite
titleColorwhite
borderWidth1
titleBGColor#232323
borderStylesolid
titleIn this page

Table of Contents
depth2

1. Configuring disposition codes using Log a Call

If your agents use Log a Call to add notes and other details during a call, 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 for NewVoiceMedia in Salesforce227154569.

How do I enable agents to select a disposition code for a call?

...

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 NewVoiceMedia account key.

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

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

polik21xpsu

...

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

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

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

Insert excerpt
_ExcerptDispositionCodeMapping
_ExcerptDispositionCodeMapping
nopaneltrue

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 a call rather than Log a Call, you can configure the custom component to set disposition codes as required.

...

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

Panel
titleCode for configuring disposition codes in custom component

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

...

When your custom component runs the configured Apex code, the DispositionCodeService sets the disposition code for the call in NewVoiceMedia.

Visualforce example

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

Expand
titleVisualforce 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:

Code Block
languagejava
titleVisualforce 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;
    }
}


Code Block
languagejava
titleVisualforce 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.

Expand
titleFlows example

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

Code Block
languagejava
titleDispositionCodeService 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 NewVoiceMedia.')
    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:
    Add Apex actionImage Added
  3. In Set Input Values, click to include input values.
    Include input valuesImage Added
  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 NewVoiceMedia, 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.

Expand
titleExample of SetDispositionCodeForCurrentCall within a future method


Code Block
languagejava
titleDispositionCodeService 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 Block
languagejava
titleCode 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 NewVoiceMedia
        DispositionCodeServiceFutureWrapper.SetDispositionCodeForCurrentCallInFuture('DISPOSITION_CODE_VALUE');
    }
}


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

...

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

Configuring setting the disposition code for a call based on the call's outcome

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

...