1

Is it possible to search multiple fields?

I am using the query:

$search = 'FIND {'.$email.'} IN EMAIL FIELDS RETURNING CONTACT(ID)';
$response = $mySforceConnection->search($search);

I would like to do something like this:

$search = 'FIND {'.$email.', '.$firstname.'} IN EMAIL,NAME FIELDS RETURNING CONTACT(ID)';
$response = $mySforceConnection->search($search);

Is that possible?

1

You may be able to apply a SOSL where condition if you had an exact email match. But I don't think the Find {SearchQuery} will span fields.

Otherwise you might find a directly SOQL search to be an easier approach if you know you are just searching for the email address and name.

  • So I can basically add the condition in the WHERE clause? – odedta Jul 13 '17 at 8:26
  • 1
    @odedta Yes, a standard SOQL where clause can handle these conditions. – Daniel Ballinger Jul 13 '17 at 23:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.