Website selection with IF logic

Hi! I'm trying to pull a bunch of info from a client page and color code it. I want the snippet to grab the answer of this test (which it seems to do successfully) and then IF the grabbed text matches "New, In Progress" I want it to populate an X. Am I putting something wrong? With the below snippet it grabs the answer I'm looking for but the IF function doesn't seem to read it right.

Permit Status: {site: text; page=https://renewalbyandersen.lightning.force.com/; select=ifneeded; selector=[field-label="Permit\ Status"] [data-output-element-id="output-field"]}{if: contains({site: text; select=ifneeded; selector=[field-label="Permit\ Status"] [data-output-element-id="output-field"]; page=https://renewalbyandersen.lightning.force.com/}, "In Progress, New")}:x:{else}:heavy_check_mark:{endif}
LSWP Status: {site: text; select=ifneeded; selector=[field-label="LSWP\ Test\ Results"] [data-output-element-id="output-field"]; page=https://renewalbyandersen.lightning.force.com/}{if: contains({site: text; select=ifneeded; selector=[field-label="LSWP\ Test\ Results"] [data-output-element-id="output-field"]; page=https://renewalbyandersen.lightning.force.com/}, "Positive, In Progress")}:x: Include LSWP Form {else}:heavy_check_mark:{endif}

Ends up with this result. LSWP Status shows in Progress yet still checks it
Permit Status: Received✔️
LSWP Status: In Progress✔️

Hi @Nathan_Manning,

{site: text; page=https://renewalbyandersen.lightning.force.com/; select=ifneeded; selector=[field-label="Permit\ Status"] [data-output-element-id="output-field"]} - site command retrieves Received for Permit Status and contains("Received", "In Progress, New") results in no (false value). Therefore if condition is false. That results in :heavy_check_mark:.

Same logic applies to LSWP Status.

It seems like you need to swap outptut of if condition for true and false cases, i.e. X and :heavy_check_mark:.

Awesome, how might I do that?

Here is an updated snippet:

Permit Status: {site: text; page=https://renewalbyandersen.lightning.force.com/; select=ifneeded; selector=[field-label="Permit\ Status"] [data-output-element-id="output-field"]}{if: contains({site: text; select=ifneeded; selector=[field-label="Permit\ Status"] [data-output-element-id="output-field"]; page=https://renewalbyandersen.lightning.force.com/}, "In Progress, New")}:heavy_check_mark:{else}:x:{endif}
LSWP Status: {site: text; select=ifneeded; selector=[field-label="LSWP\ Test\ Results"] [data-output-element-id="output-field"]; page=https://renewalbyandersen.lightning.force.com/}{if: contains({site: text; select=ifneeded; selector=[field-label="LSWP\ Test\ Results"] [data-output-element-id="output-field"]; page=https://renewalbyandersen.lightning.force.com/}, "Positive, In Progress")} :heavy_check_mark: {else}:x:{endif}

Thanks for your help! Is there not a way to name the web page selector like with other functions? I really want later functions to be able to reference the answer that the website selector pulls.

That is possible, here is an example that fetch first name from community.blaze.today thread and save the result into value variable that is later used to display the value:

{value={site: text; page=https://community.blaze.today/*; select=ifneeded; selector=.first}}
{=value}

1 Like