Integration · Salesforce

Integrate MaritzCX with Salesforce

Customer satisfaction is the success of any business. MaritzCX is an application that provides Customer Experience software (CX) and research to help respond to the Voice of the Customer instantly through CX Platform. MaritzCX, integrated with SF, helps add meaningful, actionable customer experience data to Salesforce. This blog is intended to share information on Integrating Maritz with Salesforce.

How effectively does Maritz help you on Salesforce platform?

Send a MaritzCX feedback survey upon case closure to the contact to whom the case belongs. Maritz efficiently handles the feedbacks submitted by the recipients and sync them to the associated Salesforce org. Maritz also helps you automatically create a new case in Salesforce based on the customer feedback. Apart from these integrations and configurations, we will also discuss about customizing the newly created case’s fields in salesforce as well as the implementations regarding notifying users about the new case created in salesforce.

Integrating and Synchronizing MaritzCX Data with Your Salesforce Platforms

Primarily, make sure that the Salesforce integration feature is enabled and the authentication inititated at the Maritz account side. All the actions required for the synchronization are performed on the MaritzCX side; the only thing we have to do within Salesforce is log into the account that is linked to MaritzCX.

Create the survey on MaritzCX platform which should be sent upon case closure.(Enable the Protection and Authentication settings in the survey).To create email texts and to set the default templates, navigate to Manage Email Text , Email List options. Under Email Lists –> More –> API Survey Setting –> Change Settings option, you also have the provision to set the fatigue rule which determines the pattern in which mails are sent.

Well, now  the survey is created and the settings done at  Maritz side. What’s next?

Trigger the survey and sync the responses from MartizCX to Salesforce

Step 1:    Login to Maritz account and go to:

Manage –> Collection  –>  Salesforce.com Data

For the survey created in Maritz, create a new invitation setting as follows:

mar7

blo98

Primary salesforce object: Specify the object which would trigger the invitation setting.

Standard Attribute Mapping: Specify the details of the recipient of the survey invitation. This is the only place where we specify the recipient of the survey.

Pre-Populated Data section is used to pre-populate answers on the feedback survey.

On clicking the Save button, the invitation setting will be saved on the MaritzCX platform and would generate an “Invitation Setting ID”. We use this invitation setting Id later in the process builder we create in salesforce.

Activate the invitation settings using the toggle button.

Step 2:

In the salesforce org, create a process builder on Case object which gets triggered when status on a case is changed to Closed. In the Immediate action section, select the apex class ‘Send MaritzCX Survey Invitations’  which comes with the  Maritz package.

blo4

To note:

– The object on which process builder is created should be same as the Primary Salesforce Object defined in the Invitation File Setting page on the MaritzCX platform.

–  MaritzCX Invitations Settings Id should be same as the Invitation Setting Id in Invitation file settings on Maritz side.

–  Record Id would be the Id of the record on which the process builder is triggered, e.g. if the primary   object is “Case” then the Record Id will be [Case]. Id

Done! Now, when the case status in Salesforce is updated to Closed, the process builder gets triggered which in turn triggers the appropriate survey from the Maritz account with the help of the apex variables. The survey will be sent from the Maritz account to the email specified in the Invitation File Settings.

Navigate to Response List section in Maritz to track the responses submitted by the customers.Out next aim is to push these responses to salesforce? How do we do that? Here it goes..

Within the Maritz account, go to:           Manage —> Integrations —> Salesforce

The mapping we create here will be used to push survey responses from Maritz to Salesforce.

Mar3

Select Object Setup Type: By default, this will be Business Account. (In case if Person Account is enabled for the Salesforce org, you may select Person account)

Select Salesforce Unique Key: Select any unique field in the contact object. Maritz will be syncing the responses to Salesforce depending on this unique Key. In the example depicted, I have used Email as the key.

Select Unique Key Field Question:  Select the question in the survey to which the answer will be the unique key that we selected above.

Note: Suppose you are updating a case in which the contact has the email field empty, then keep in mind that Maritz will fail to sync the responses to Salesforce even though the survey will get sent and response appears in response list at the Maritz side.

Map Salesforce fields: Map the questions in the survey to the fields in Salesforce as shown in the screenshot. The salesforce fields Key metric 1, Key metric 2 etc. belongs to the Survey Response (API name: MaritzCX__Survey_Response__c) object in salesforce which comes with the Maritz package. So, here, we are simply mapping the answers of the survey questions to survey response object’s fields in Salesforce.

Enable the toggle option in the mapping page for the responses in survey to be synced to Salesforce.  If  disabled, the responses for the survey will not be synced to Salesforce.

The survey and the selected survey questions from MaritzCX will be pushed to Salesforce’s Survey and Survey Question objects respectively.

Survey response data is synced between the two platforms (US every 30 minutes, EMEA every 2 hours).

Now, you will be able to see the survey response records in salesforce as follows:

Mar4Note:

Suppose if a response (which is already synced to Salesforce) is deleted from MaritzCX platform (from the response list section), it will  be deleted from Salesforce also. If that response is associated with any case, then the following changes occur in the case:

-The case that was newly created is marked as read-only and the Status is updated as “Closed”

– The View Response field shows “Original Response Deleted”.

Create a new case in Salesforce depending on the Customer Feedback

Suppose you need to create a new case in salesforce when the recipient responds ‘No’ to the survey question – “Are you satisfied with our service?”.  How do you think we can do this?  If you thought of setting up something in salesforce org, nope – that’s not the way. Maritz does that too!

In Maritz account, go to:       Manage —> Manage Alerts

Select ‘Create a case in Salesforce’ in the Alert type section

Provide the survey question in the define Criteria section. (When the response to this question results in an alert, a case will be created in Salesforce that is associated with the respective response record in Salesforce).

mar5

mar6

Specify the content of the alert email that will notify designated Salesforce users that a case has been created.

Customizing the New Case and Notifying the Users

The newly created case from Maritz will have the fields populated. Now what if you need the new case’s fields customized?Like,suppose that you need the new case’s fields to be populated with the values from the case that triggered the survey as well as the response.Simple, we can implement a trigger on case insertion. But then, we get to notice one thing out here. MaritzCX survey response object has a lookup field – Case (API name: MaritzCX__Case_Id__c)  related to Case object. This holds the case that is newly created. Then, how do we get the case that triggered the survey?  For this, we can create a new custom lookup field “triggered case” in response object. Also, in the Integrations section in Maritz, map the Case number field to any one field in response object in SF. Here, we have mapped it to the ‘metric 8’ field in the response object so that the inserted survey response record in Salesforce holds the case number of the case that triggered the survey.

Now, let’s make use of this case number in a before insert trigger on Survey Response object to populate the triggered case lookup field with this case-the case that triggered the survey.

Trigger

Note:  Certain times when response records are inserted to Salesforce from Maritz CX, there is a possibility that MaritzCX__Survey_Response_Id__c  is not populated initially but get updated after few minutes. In such cases, make sure the trigger is called on both insert as well as update.

@description: trigger to relate the triggered case to the response inserted from Maritz(before insert)

list  responseList=new list ();
for(MaritzCX__Survey_Response__c responseRec:trigger.New){
if(responseRec.MaritzCX__Metric_8__c!=null){
responseList.add(responseRec);
}
}
if(responseList.size()>0){
Maritz_SurveyResponseTriggerHelper.populate_triggeredCase_inResponse(responseList);
}
}

Trigger Helper Method

public static void populate_triggeredCase_inResponse(list tiggerNew){

        Set triggeredCaseNumber=new Set();
        for(MaritzCX__Survey_Response__c maritzResponse:tiggerNew){
            triggeredCaseNumber.add(maritzResponse.MaritzCX__Metric_8__c);//storing triggered case's case number from the response to a set
        }

        //fetching the cases using the case number in the response created/inserted from Maritz
        Map triggeredCaseMap=new Map([select id,Type,CaseNumber,Member__c from Case where CaseNumber in:triggeredCaseNumber]);

        for(MaritzCX__Survey_Response__c maritzResponse:tiggerNew){
            for(case c:triggeredCaseMap.values()){//looping over all the fethced cases
                if(c.CaseNumber==maritzResponse.MaritzCX__Metric_8__c){//if the case number associated to the response is equal to the case number in the fetched case
                    maritzResponse.triggeredCase__c=c.Id; //storing the Id of the case in the triggeredCase lookup field in response
                }
            }
        }
    }

Now that we have the survey response object related to both (1) the case that triggered the survey as well as (2) the new case. Now, on new case’s insertion from Maritz to salesforce we can implement a trigger to customize its fields as follows:

@description: trigger to relate the triggered case to the response inserted from Maritz (after insert/update on case)

Note: Certain times when response records are inserted to Salesforce from Maritz CX, there is a possibility that MaritzCX__Survey_Response_Id__c is not populated initially but get updated after few minutes. In such cases, make sure the trigger is called on both insert as well as update.

if (trigger.isAfter) {
    if (trigger.isInsert) {

        Set  caseIdSet = new Set();
        for (Case c: trigger.New) {
            if (c.subject == 'Customer Solutions Transaction Survey') {
                caseIdSet.add(c.Id);
            }
        }
        if (caseIdSet.size() > 0) {
            Caseactions.populateNewMaritzCasefields(caseIdSet);
        }
    }

    //after update (since,certain times responses while inserted from Maritz does not have the Maritz Survey Response lookup populated)
    if (trigger.isUpdate) {
        Set  caseIdSet1 = new Set();
        for (Case c: trigger.New) {
            if (c.subject == 'Customer Solutions Transaction Survey' && c.MaritzCX__Survey_Response_Id__c != null) {
                caseIdSet1.add(c.Id); }

        }
        if (caseIdSet1.size() > 0) {
            Caseactions.populateNewMaritzCasefields(caseIdSet1);
        }
    }

Trigger Helper Method:

@future
public static void populateNewMaritzCasefields(Set  caseIdSet) {
        set  relatedResponseId = new Set  ();
        Map  responsewithNewcaseMap = new Map  ();

        //querying all the new cases created by Maritz
        list  caselst = [Select Id, MaritzCX__Survey_Response_Id__c, Type, Status, Origin, Priority, AccountId, ContactId, Description, maritzEmail1__c, maritzEmail2__c from Case where Id =: caseIdSet];

        for (Case c: caselst) {
            relatedResponseId.add(c.MaritzCX__Survey_Response_Id__c); //storing the id of the response related to the new case
        }

        //querying the responses using the id stored in the previous set
        Map  relatedResponseswithCaseMap = new Map  ([select id, MaritzCX__Metric_5__c, MaritzCX__Account__c, MaritzCX__Case_Id__c, MaritzCX__Contact_Id__c, triggeredCase__c from MaritzCX__Survey_Response__c where id in: relatedResponseId]);

        Set  triggeredCaseIdset = new set  ();
        for (MaritzCX__Survey_Response__c res: relatedResponseswithCaseMap.values()) {
            triggeredCaseIdset.add(res.triggeredCase__c); //fetching the Id of the Case that triggered the Survey using the queried response records.
        }

        //querying all the triggered cases along with the type field
        Map triggeredCaseMap = new Map ([select id, type from Case where id in: triggeredCaseIdset]);

        Map  responsewithTriggeredCaseType = new Map  ();
        list  updateCase = new list  ();

        for (MaritzCX__Survey_Response__c res: relatedResponseswithCaseMap.values()) {
            if (triggeredCaseMap.containsKey(res.triggeredCase__c)) {
                responsewithTriggeredCaseType.put(res.Id, triggeredCaseMap.get(res.triggeredCase__c).Type); //storing the id of the response and the Type field of the triggered case in a map
            }
        }

        for (Case c: caselst) { //looping over the newly created cases
            if (responsewithTriggeredCaseType.containsKey(c.MaritzCX__Survey_Response_Id__c) && relatedResponseswithCaseMap.containsKey(c.MaritzCX__Survey_Response_Id__c)) {

                //populating the new case with the required values from the triggered case as well as the response.    

                c.Type = responsewithTriggeredCaseType.get(c.MaritzCX__Survey_Response_Id__c);
                c.Status = 'Working';
                c.Origin = 'Survey';
                c.Priority = 'High';

                c.AccountId = relatedResponseswithCaseMap.get(c.MaritzCX__Survey_Response_Id__c).MaritzCX__Account__c;
                c.ContactId = relatedResponseswithCaseMap.get(c.MaritzCX__Survey_Response_Id__c).MaritzCX__Contact_Id__c;

                updateCase.add(c);
            }
        }

        if (updateCase.size() > 0) {
            Database.update(updateCase);
        }

    }

Now,the newly created case record will have the fields populated as required.

Now, whenever a new case is created in the org, if you need to notify the users about the new case, you can simply implement a workflow in salesforce. Below is a sample workflow:

blo11

 Additional notes:

On the MaritzCX platform, the page SFDC Response Failure allows survey administrators to monitor any errors that occur during the response push process. To access it, go to:

Surveys & Data Collection | Survey Hub | Manage | SFDC Response Failure.

Also,you may make use of the MCX Permissions tab  in  MaritzCX Connector  App in salesforce  org to check the minimum permissions required for an integration user.

Thus using MaritzCX with salesforce, provide your sales and support team, instant access to the detailed, real-time CX information they need to understand their customers’ needs and concerns, identify trends and problem areas, and take fast, positive action every time they view an account profile!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s