Using the Site Selector in SalesForce and Multiple Matches


I was wondering how to use the {site: text; selector=} for specific fields in SalesForce. E.g. extracting the First and Last Name (Or just the First Name), Contact Email, etc.

Contact Name.

How can I do this with any field that is formatted similarly? (Account Name, Case Number, etc.). I've been using this {=extractregex({site: text}, "Name: ([\w]+)")} to extract specific texts on the page, which works in some aspects but I've yet to figure out to apply this to the example above. I feel that using the "Selector" or CSS route would pull specific text that I want as well. Also, the problem is there are sometimes 2+ fields that may be labeled "Contact Name", so I need to get either the first or second field.


I've been using the Dev Tools to inspect and the "Copy selector" option to locate/add elements.

When you have multiple matches for a selector and you want something other than the first one, you can use the multiple=yes setting on the {site} command.

It will cause the {site} command to return a list of all the matches. You can reference the nth match using the list[n] syntax.

For example, on this forum page ".title" matches the items which are titles. We can get specific ".title" matches like this:

Second ".title" match: {={site: text; selector=.title; multiple=yes}[2]}
Fifth ".title" match: {={site: text; selector=.title; multiple=yes}[5]}

Number of ".title" matches: {=count({site: text; selector=.title; multiple=yes})}

All the ".title" matches:

{site: text; selector=.title; multiple=yes}

Thanks! I have gotten this to partially work but I'm not understanding what to add/change in order to capture the full name under "Contact Name".When I've attempted it, it will also pull the "Edit Button" in the result. E.g. It will come back like:

Monica Parker
Edit button

If I "Copy Selector" from the dev tools in Chrome on the Contact Name filed portion I get div:nth-child(1) > div > div.slds-form-element__control.slds-grid.itemBody > span but this doesn't seem to specify a field unless I add [2] to the end. Not sure If I'm even close to doing it correctly.

I want to exclude the "edit button" on that line and isolate only the name. I am still learning this process so hopefully that made sense.

**I figured out how to do it via {site: text}, which has solved my problem. {=extractregex({site: text}, "[\s\S]*\nContact Name\n(.+)")}

That CSS selector is a mess :grimacing: -- it's highly likely to break if SFDC changes anything on the page. There is probably something much simpler.

If you are open to it, I think this may be worth doing an office hours on this topicc and spending the time to walk through the different concepts here and how to develop these types of data extractions.

We can do a public video meeting where we walk through your question in more depth. If anyone else has related questions they can call in and ask too. The call will be recorded and you'll need to present your screen for us to develop a good solution together (so make sure to add a fake customer record we can work with so you don't share real customer data).

I can do this Friday June 26th at 8AM or 9AM Pacific time. Do one of those work for you?


Hi Scott,

Yes, that would be great to do a video chat on this topic. However, I will be OOO this Friday. Is there a time next week that works? Or whenever there is a next available time.


Sure, how about one of those times Friday the 3rd of July.

Friday July 3rd at 9AM Pacific Time is great.

Great. Sent you an invite and posted a general invite here: [Experiment] Text Blaze Office Hours July 3rd

I'm having a similar issue with selectors in Salesforce. They're super long and messy and do not locate what I'm trying to extract from the page. Did you ever find a good method of selecting items out of Salesforce?