+ Start a Discussion
Keith Stephens 18Keith Stephens 18 

Escaping soql help

Hello All,
I am having issues with I think escaping values into my soql statment. Here is what I have
String userEmail = UserInfo.getUserEmail(); 
system.debug(userEmail);


String url = 'https://test.salesforce.com/services/data/v40.0/query?q=SELECT+Attny_Phone_From_Contact__c,Attorney_Email_from_Contact__c,Attorney_Email__c,Attorney_Fax__c,Attorney_First_Name__c,Attorney_Full_Name__c,\''userEmail'\', Attorney_Last_Name__c,Id,Plaintiff_First_Name__c,Plaintiff_Full_Name__c,Plaintiff_Last_Name__c+FROM+Case+limit+3';
system.debug(url);

Yes, I want to return the UserEmail this way, but I am getting an "Unexpected token 'url' error.
Thanks for the help or guidance.
Keith.
Best Answer chosen by Keith Stephens 18
Keith Stephens 18Keith Stephens 18
Found my answer, sorry and thanks. Mised the PLUS sign.

String url = 'https://cs17.salesforce.com/services/data/v40.0/query?q=SELECT+Attny_Phone_From_Contact__c,Attorney_Email_from_Contact__c,Attorney_Email__c,Attorney_Fax__c,Attorney_First_Name__c,Attorney_Full_Name__c,\''+userEmail+'\', Attorney_Last_Name__c,Id,Plaintiff_First_Name__c,Plaintiff_Full_Name__c,Plaintiff_Last_Name__c+FROM+Case+limit+3';