You need to sign in to do that
Don't have an account?
System Administrator 874
Writing a query using SOQL to search for users using their first name and email
I am trying to write a query which will allow me to search for a user using their email and first name. I have it working mostly, however the issue I am facing is when a user has two or more words in their first name.
For example - John Second Doe
Where they add John Second as their first name and Doe as their last name.
I am using PHP to submit the request to Salesforce and then find the contact and assign their ID to our system.
Select+Id+From+Contact+Where+Email='johndoe@lc.com'+AND+FirstName='John Second'
This is how the query looks so far, however this returns null. I assume this is because either its not supported or I am passing it in a wrong format. I have tried adding a + and %20, however niether work. I get an empty object.
I have confirmed that I have that user in my Salesforce system. (the name has been changed for the ticket).
For example - John Second Doe
Where they add John Second as their first name and Doe as their last name.
I am using PHP to submit the request to Salesforce and then find the contact and assign their ID to our system.
Select+Id+From+Contact+Where+Email='johndoe@lc.com'+AND+FirstName='John Second'
This is how the query looks so far, however this returns null. I assume this is because either its not supported or I am passing it in a wrong format. I have tried adding a + and %20, however niether work. I get an empty object.
I have confirmed that I have that user in my Salesforce system. (the name has been changed for the ticket).
Why have you written plus after each word in your query?
Try this query it worked for me.
If you still get null try refreshing or closing console and try again as records have not been updated.
Hope this helps.
Would you be able to tell me how you were running the query?
Based off the docs I believe we need the + as well.
https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/resources_query.htm
PFA Screenshot below