GetFeedback

Encrypting Merge Fields

By default, respondents can view the merge field data in the survey link. For example, if you use the Contact ID merge field, your respondents can see their Contact ID in the link when they take your survey. Respondents may also be able to manipulate or remove merge fields from your survey link. You can encrypt merge fields to hide personal data from your survey respondents and prevent them from changing the link.

GetFeedback Support can’t consult on coding issues. Reach out to your Salesforce administrator for help implementing these features. These examples help you get started with our Salesforce integration and you may need to make changes for your organization.

Create a custom field for encrypted data and an apex trigger to fill the field with merge fields you’d like to include.

  1. Create a custom field called GF Encrypted Data.
  2. Create a new trigger, using the code sample below as an example. It’s best to work with your Salesforce administrator before using this code.
Blob key = EncodingUtil.convertFromHex(<encryptionKey>);
Blob encrypted = Crypto.encryptWithManagedIV('AES128', key, Blob.valueOf(
'ContactId=&CaseId=&FirstName='
));
String cipherText = EncodingUtil.convertToHex(encrypted);
// Store this value in your custom field GF_Encrypted_Data__c

Make sure to replace the encryption key and merge fields we have in angle brackets with the merge fields that you’d like to collect, using the correct syntax for each. Admins can generate or delete GetFeedback encryption keys in their account settings under Encryption keys. You can create two tokens at a time.

To turn on encryption for your survey:

  1. Create or open a survey.
  2. From the survey builder, select Settings. Make sure you’re in the Draft survey.
  3. Under Merge Field Encryption, turn on the toggle to Use encrypted merge fields in survey links.
  4. Select Publish draft.

If you’re creating a template to send from Salesforce, copy the survey link to add to your Salesforce email template. If you’re sending your survey using our Salesforce automation, you don’t need to copy the survey link.

To copy your survey link:

  1. From the survey builder, select Distribute > Survey Link.
  2. Select Copy.

You can use this link in the email you create in Salesforce.

Create the email that will go out from Salesforce. If you’re using our Salesforce email automation, we create the Salesforce flow and outbound message for you.

Once you paste your survey link into the email, you can add your encrypted merge fields. You can put a merge field in an email template, custom URL, or formula to incorporate values from a record. A merge field stores information so the link can pull customer information when someone takes your survey.

To add encrypted merge fields, use the code below, replacing the link with your own survey link.

https://www.getfeedback.com/r/xxxxxxxx?gf_data={!GF_Encrypted_Data__c}

Note that {!GF_Encrypted_Data__c} is the custom field that we just created back in step one.

Once your email is sent, your custom field will then pull in all of your merge fields based on the apex trigger you created. Test your email a few times using real contacts in Salesforce before sending to your larger list.

Make sure to send respondents the encrypted version of your survey link. Otherwise, the survey won’t display.

If you're using a distribution tool other than Salesforce, you may need to write custom code. Please use the encryption libraries available for your platform. You’ll need to:

  • Encrypt the query string parameters using AES128 encryption
  • Encode the ciphertext as a hexadecimal string
  • Use the hexadecimal string as the gf_data querystring parameter of the survey link.