You need to sign in to do that
Don't have an account?
Apostrophe translated to '
I am using Salesforce's email services to populate a Contact record with information submitted through a web form. A user fills out the web form, all of the information from the form is sent as an email, the Apex class parses the email, and populates the Contact record.
The problem I have is that I have picklist values on the form that have an apostrophe(') in them. They are "Bachelor's" and "Master's" . When the email class parses the information, the field on the Salesforce side is populated with"Bachelor's" or"Master's". Here is the Apex code that parses that line:
contact.Highest_Degree_Earned__c = getFieldValue(myPlainText,'Education:');
How can I account for a value returned with an apostrophe? This seemed to just started happening when we were upgraded to Spring 09 release.
Thanks
You could try something like:
contact.Highest_Degree_Earned__c = getFieldValue(myPlainText,'Education:').replace(''','\'');
All Answers
You could try something like:
contact.Highest_Degree_Earned__c = getFieldValue(myPlainText,'Education:').replace(''','\'');
public with sharing class LookupController {
public BMCServiceDesk__Incident__c inc {get; set;}
public String accountName {get; set;}
public Id accountId {get; set;}
public String callerName {get; set;}
public Id callerId {get; set;}
public List<User> users {get;set;}
public List<User> callers {get; set;}
ApexPages.StandardController GstdController;
public LookupController(ApexPages.StandardController controller) {
GstdController = controller;
this.inc = (BMCServiceDesk__Incident__c)GstdController.getRecord();
this.users = [Select Id, Name from User where Id = :inc.BMCServiceDesk__FKClient__c];
this.callers = [Select Id, Name from User where Id = :inc.FKUser1__c];
if (users.size() > 0)
{
this.accountName = users[0].Name;
this.accountId = users[0].Id;
}
if (callers.size() > 0)
{
this.callerName = (callers[0].Name.replace(''','\''));
this.callerId = callers[0].Id;
}
}
public PageReference mysave()
{
if (accountName == '' || accountName == null || inc.BMCServiceDesk__FKClient__c == null)
{
ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR, 'Please enter a value in the Client Name field.'));
return null;
}
else
{
pageReference ps = GstdController.save();
pageReference pv = GstdController.view();
return pv;
}
}
}