Including information from Salesforce Page in Snippet

Tryingl to get emails done quick with context from my SalesForce lead work page but selector id changes from lead to lead, any way I can get this working?

thanks

Could you provide a bit more information about what exactly is occurring. A screenshot might be helpful for us to understand the issue.

trying to get the highlighted area on the body of the email

Thanks, so my understanding you are trying to use {site} to extract that part of the page.

The best approach would be to use a CSS selector as part of the site command. It sounds like you are trying to do that but the id for the element is not deterministic. First I would suggest looking a bit more into it. It's possible there is some non-id way to always select the correct element. For example, by using the nth-child selector or an attribute selector:


If that doesn't work, you can always import the whole page as text or html and then use a regular expression to extract the relevant part of the page. It looks like what you want will always be proceeded by "Strategic Partner Employee" and a number.You can define a regular expression to pull exactly what you want based on this.

Here's a quick example of how to use a regular expression to do something like this:

{page_text="blah blah\nStrategic Partner Employee\n1234 John Doe\nblah blah"} <- in practice this would be loaded via the site command

Name: {=extractregex(page_text, "Strategic Partner Employee\n\d+ (.*)")}

1 Like

Thanks Scott, it worked but only works if I have 4 numbers before the name like "0735" if I have number and letters won't work "072A".

You could change it to the following if your id included letters.

{page_text="blah blah\nStrategic Partner Employee\n1234 John Doe\nblah blah"} <- in practice this would be loaded via the site command

Name: {=extractregex(page_text, "Strategic Partner Employee\n[\w\d]+ (.*)")}