Help

Re: Trying to create automation to input tags on certain new products that meet the criteria

899 0
cancel
Showing results for 
Search instead for 
Did you mean: 
J_Tamminen
4 - Data Explorer
4 - Data Explorer

I am trying to figure out how I could create an automation that would fill one cell with tags when the new record that I have made consists a certain word. For example I add a product type chair, it would add all the tags that I would use for chair.

Is this possible to do in automation or should I try to think of a script?

Thanks for the help!

1 Reply 1

You could have several different Automations, one for each keyword, that inserts a predefined list of tags into the multiselect field.

Or you could use a single Automation that includes a Run a script action. Here is a very rudimentary script that checks incoming text (provided by an input config variable) for matching predefined keywords:

let {text} = input.config()

let keywords = [
    // Add more {keyword: "", choices: []} objects as necessary
    {keyword: "new", choices: ["New", "Featured"]},
    {keyword: "chair", choices: ["Furniture", "Seating"]},
]

let applicableChoices = Array.from(new Set(keywords.flatMap(pair => {
    let {keyword, choices} = pair
    // remove the ".toLowerCase()" parts if you want keyword matching to be case-sensitive
    if (text.toLocaleLowerCase().includes(keyword.toLocaleLowerCase())) {
        return [...choices]
    }
    return null
})))

output.set("choices", applicableChoices)

Then add a Update record step that fills in the multiselect field with the choices output from the script.