AnsweredAssumed Answered

Velocity script for service satisfaction survey

Question asked by Frederique Lans on Jan 7, 2019
Latest reply on Jan 7, 2019 by Sanford Whiteman

We want to send a service satisfaction survey to customers whose service request has closed in the past week.

The service request information is stored in SFDC. The survey is created in GetFeedback.

We are using a velocity script within a token to build the unique survey URL. The URL is built as follows:

#set($url1 = "")

#set($url2 = "")

#set($url3 = "")

#set($url4 = "")

#set($url5 = "")

      #set($url1 = "")

      #set($url2 = "&CaseID=")

      #set($url3 = "&Survey_Name=Service&Service_Request=")

      #set($url4 = "&Service_Request_Owner=")

      #set($url5 = $url1 + ${lead.Unique_Contact_Id__c} + $url2 + ${CaseList.get(0).Id} + $url3 + ${CaseList.get(0).CaseNumber} + $url4 + ${CaseList.get(0).OwnerId})  

      <a href="${url5}" class="mktNoTrack" style="text-decoration: none; color: #cb333b;">Start Survey ›</a>


A smart list in a campaign is used to select the customers who have a service request with the status “closed” and the closed date has a time frame of “this week”.


Some customers might have several outstanding service requests. Therefore it is necessary to select the most recently closed service request.

For this reason we have tested adding $sorter.sort, #foreach and #if commands, but this does not work yet.


It also seems like the smart list conditions and the email script token do not match together.

A customer who had several outstanding service requests, received the survey URL based on the most recent service request which was not closed.


Does anyone have suggestions on how to fix the velocity code?


Thank you in advance.