Dependent Field Logic Using Single Line Text Field

I’m trying to use dependent form field logic based on what’s typed in a single line text field.

We want to try to use standard HubSpot field which is mapped to a standard Salesforce field. The standard HubSpot field (Industry) is a single line text field.

Unfortunatly, contacts can input whatever they want and in different formats (uppercase or lowercase, synonyms, abbreviations, ect). I tried to input a variety of field inputs to cover all basis however when its tested it does not work. It only works with one word is populated, not multiple seperated by a comma or semi colon.

If this were a picklist or any other field type this would be easier and a non-issue. Just wondering if there is documentation or recommendations on using single-line text fields for form logic.

Here are a few ways to handle field arguments based on a single line text field in HubSpot:

- Use the `contains()` function to check if the text field contains any keywords. Example:

```
if (contains(services, “construction”) || contain(services, “vehicle”)){
//Show construction locations
} . } . } . } .
```

This will work if the industry also contains “construction” or “vehicle” in comma-separated characters.

- Use the `startsWith()` or `endsWith()` function to determine whether the text begins or ends with a value.

- Split the text field into an array using `split()` and loop through the array to check for the keyword.

```
var jobs = partition(jobs, “,”);
for (var i = 0; i < tasks.length; i++){
if(services[i] == “Technology”){
//Display tech fields
} . } . } . } .
} . } . } . } .
```

- Use hidden fields to store standardized industry values ​​and search against them rather than raw text fields. You can fill the hidden field with workflow or JavaScript.

- Consider changing the text to a multi-select checkbox field for projects to make understanding and standardization easier.

The main challenge with free text is to account for formats, spellings, abbreviations, etc. Functions such as `contains()` and partitions into arrays can help solve this logically Standardization of values is also recommended at Forms Summit.
Let me know if this helps!

Madhur Gusain

Marketing Operations SpecialistGrorapid Labs
+918287977394
hello@grorapid.com
https://labs.grorapid.com/
Create Your Own Free Signature