• Nicholas Sartor
  • NEWBIE
  • 5 Points
  • Member since 2020

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 1
    Replies
Hi all!

I'm struggling to get the right SOQL query in a way that I can search and filter by URL addresses, through the API.

We have a custom field "Crunchbase_URL__c", which can be both written by my application (usign the REST API), or filled in manually by the used.

Most of the the times, when the URL was filled automatically, the line
.../services/data/v47.0/query?q=SELECT Name FROM Account WHERE Crunchbase_URL__c = 'https://www.crunchbase.com/organization/{the permalink that I'm searching}'
will work without any issues, but sometimes when the user would only type www.crunchbase.com/.... without the https the query obvioulsly comes back empty.

I tried to use 'LIKE' instead of the '=' operator, but it looks like it would only work with a string beginning with the query term. So
SELECT Name FROM Account WHERE Crunchbase_URL__c LIKE '%crunchbase.com/....'
is not working.

Currently my workaround is to query for all the possibilities (from my Javascript code):
"Crunchbase_URL__c = 'https://www.crunchbase.com/organization/" + Sel_row.QueryName + "'" +
                            " OR Crunchbase_URL__c = 'https://crunchbase.com/organization/" + Sel_row.QueryName + "'" +
                            " OR Crunchbase_URL__c = 'http://www.crunchbase.com/organization/" + Sel_row.QueryName + "'" +
                            " OR Crunchbase_URL__c = 'http://crunchbase.com/organization/" + Sel_row.QueryName + "'" +
                            " OR Crunchbase_URL__c = 'crunchbase.com/organization/" + Sel_row.QueryName + "'" +
                            " OR Crunchbase_URL__c = 'www.crunchbase.com/organization/" + Sel_row.QueryName + "' "
but this hardly looks like the right approach.

furthermore, when querying for the standard Website field I have exactly the same issues.

Thanks for your help!

Hello Salesforce Experts,

 

Anyone please let me know how to write valition rule for URL ?

Else someone please provide regular expression string for URL ?

 

Thanks,