Salesforce does not provide any ways to capture customers’ feedbacks as a standard feature, most companies will have to rely on pricey appexchange apps to achieve this.

Considering what we need is a simple way to rate resolved cases, buying something that cost $x per user per month just sounds incredibly expensive.

Fortunately, there is still hopes. Salesforce gives us the ability to create something called Salesforce Site, we can use this to gather end users feedbacks via email.

This is how it’s done:

  1. Salesforce automatically/manually sends an email to the customer
  2. The customer clicks on a link in the email (maybe behind a happy/sad face)
  3. A customer satisfaction feedback can be created in Salesforce and linked to the case.

Sounds extremely useful hey? Let’s get started. (I won’t be posting any code for this tutorial btw)

Firstly, we need to create a custom object to hold the feedback value. This should be easy for all of us, just make sure there are at least three fields in the custom object:

  1. Case__c
  2. Score__c
  3. Comment__c

These names are pretty self-explanatory, I won’t dig too much into it.

Then, we need a controller to handle user selections. Since it’s a link inside an email template, they can only be GET requests. We use the standard method in Apex to read the request that looks like this .salesforce.com/?score=x&caseid=

ApexPages.currentPage().getParameters().get('score');

And then, the Apex class will parse this request and create a feedback with score = x and attach it to the case with .

The next step is to create a visualforce page that is used for customers to fill in feedback comments. This should be very easy, again, I am using the Google Material Design to beautify the page. (and don’t forget the submit button)

Almost there, we now need to create a Salesforce site, we do this by going into Setup -> Develop-> Sites. (If you haven’t created one before, be sure to get a domain name for your site. ) Click on New to create a new site. Put on the label and a preferred URL, and put the name of the visualforce page we just created under “Active Site Home Page”. Save it, and test it make sure it’s working by clicking on the link under “Custom URLs”.

This should open an external page that contains a dropdown to pick a score and a free text area to type in comments. Of cause this page won’t work, simply append the URL with any random Salesforce case id, you will see a feedback has been created under that case and the “created by user” is called something site user.

Lastly, we need an email template, to keep it straightforward and to see the result immediately, we quickly create a “Custom Email” template that contains the following three links in the email footer.

<a href="<domain>.salesforce.com/yrpage?caseid=<case id>&score=1>Happy</a>
<a href="<domain>.salesforce.com/yrpage?caseid=<case id>&score=0>I'm just fine</a>
<a href="<domain>.salesforce.com/yrpage?caseid=<case id>&score=-1>Not Happy</a>

Notice the case id is dynamic and the score is static, so customers won’t create feedbacks for the same case.

To finish up the article, I suggest you add few more validation rules around feedback creation, for example, only one feedback can be created within 24 hour period for the same case. Or you may want to use a Smiley face in your email templates instead of having just some links.

Later on, we will be able to simply run a feedback with case report and see which agent (case closed by) got the highest CSAT rating 🙂

Advertisements