3

My chief question: does Salesforce's SOSL/Parameterized search accept * wildcard searches?

Related q: Does URL encoding a url with search string parameters including asterisk and + characters compromise those characters, particularly the asterisks?

I generate a search string by retrieving strings in one dataset and then attempt to match them to the Name field on an Sobject by concatenating them into one string variable.

A generated string example before it's passed into the parameterized url looks like this: *string1*+*string2*+*string3*

Would the URL encoding encode the string *+* like this %2A%2B%2A% and negate the wildcard significance of the asterisk?

EDIT: According to this SFDC Search Documentation I am using the URL/parameterized search, but I could actually POST a JSON and get a response back. Would this enable me to use the wild card * or does parameterized search accept those as well?

2

My chief question: does Salesforce's SOSL/Parameterized search accept * wildcard searches?

Yes, you can use * and ? in search terms.

Related q: Does URL encoding a url with search string parameters including asterisk and + characters compromise those characters, particularly the asterisks?

No; specifically, if you do not encode +, it will be interpreted as a space instead of a +. If you mean to use a literal +, you must encode it. Note that using a space or a + is roughly analogous in terms of functionality, so it may not matter in your specific case, but you should be aware of the distinction. The asterisk will be interpreted correctly encoded or not, so it doesn't matter if you decide to encode it.

Would the URL encoding encode the string *+* like this %2A%2B%2A% and negate the wildcard significance of the asterisk?

No, but you'll get an error in SOSL, because + is a reserved character, and must therefore be prefixed with \ (encoded as %5C). The correct sequence would be %2A%5C%2B%2A. Parameterized search does not require this additional escape, but it also does not hurt to do so, either.

  • Thank you for the answer @sfdcfox! It is strange because I am passing in search strings with asterisks that return results via the SFDC UI but are not returning any results when making the API call, do you have any quick insights on that? I can break it out as its own question as well... – GPP Mar 5 '18 at 4:24
  • 1
    @GPP Some specific examples might help. There shouldn't be any difference as long as everything is encoded correctly. Yes, I'd probably recommend a separate question so you can give more information. I'll be glad to take a look at it for you. – sfdcfox Mar 5 '18 at 4:31

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.