Tuesday, 1 April 2014

Handling spaces in a Select Field value in an email template

I'm creating an email template called "case closed with survey". It's used in a workflow rule such that when a case is closed, a link to a customer satisfaction survey will be sent to the customer. The body of the email template looks like this:
Thank you for your support inquiry.  We have changed the status of support ticket {!Case.CaseNumber} to “closed”. Please fill out this brief survey:

https://getfeedback.com/r/iy9Ow4Ms?Case_ID={!Case.Id}&Account_Name={!Case.Account}&Case_Type={!Case.Type}&Application={!Case.Application__c}

Thank you.
"Case.Application__c" is a custom field we added to the case object, and it contains the names of our product.  The product names are multi-word with spaces: meaning an Application name could be "widget one", "widget two", etc.
When I use the template as is above, I get "&Application" as part of the URL, but it drops the Application name value after the first space - meaning that the URL ends in "&Application=widget". I've tried both single and double-quotes...when I do either of these, I don't get anything for the application name.

It was suggested that I use URLENCODE (i.e., "&Application={URLENCODE(!Case.Application__c)}") at the end of the URL.  Unfortunately, that still only gets me the first word of the application name as part of the URL.

Any way I can recode this template so that it gives me the full product name?


Answer
The URLENCODE shoud have worked! Write it like this:
{!URLENCODE(Case.Application__c)}
Meanwhile also give these a trial:
{!SUBSTITUTE(Case.Application__c, ' ', '%20')}
Also this one:
{!SUBSTITUTE(Case.Application__c, ' ', '+')}

No comments:

Post a Comment