Nov 10, 2024 02:27 AM
Hi,
This question is a detail out from another question (here: https://community.airtable.com/t5/automations/dynamically-scalable-email-content-by-quot-tag-quot-in...), for reference.
I’m trying to abstractify our CRM’s mail setup using an automation with Find Record steps with Dynamic variables. One variable I need to use is “Tag” that links contacts to an area of interest (nature, sports, food, etc). Since I use the Tag classification in many places throughout the base (currently 8 tables), I have made it into a Linked Record instead of a separate Single Select for each table. Yes, I know that if I'd use Single Selects this would work without issues :).
The problem is I can’t figure out how to use a Linked Record as a Dynamic condition in a Find Record step. I’d like to search exactly so I choose Tag “is exactly” from the Dynamic conditions. Then I only find a “Make a new list of” option, under which I can choose the tag (“nature” in this pic).
Testing this setup yields an error however, saying the filter value is invalid.
If I choose another route and use “contains” in the Dynamic conditions (which I would like to avoid), I can’t get to choose any value for the Dynamic condition, because I “cannot assign list of string to a string".
So, how can I use Linked Records as a Dynamic condition in a Find Record step? Or is it not doable?
Rgds,
Björn
Nov 11, 2024 01:35 AM
Hi,
You could create a lookup or rollup field for the Tag classification within each table where you need to search records. As such, you'll have an intermediary field that contains the tag value (like "nature") which you could utilize as a lookup field as a dynamic condition in your Find Record steps
Nov 11, 2024 03:21 AM
Hi @FarioConsulting,
Thanks for your reply. Unfortunately, it doesn't work the way I tested this with both Lookup and Rollup.
Here I try to assign a Lookup value to the Find Record step, but it gives me a "Cannot assign string to a string" error, so it behaves the same way in the Dynamic condition chooser as the straight Linked Record tag.
I couldn't find any other paths than go to "Field Values" and "Make a new list of..".
Do I do something wrong here?
Rgds,
Björn
Nov 11, 2024 12:24 PM
Hi,
Please clarify your goal. Static condition is when you want to find records, where Tag='nature' , for example
Dynamic - is like, when record updated (checkbox is ON or description is changed etc), you want to find all records, where Tag = { the same tag as in updated record }
In your example, trigger is timed action. So, you have no source of dynamic variable.
Nov 12, 2024 10:55 AM
Hi,
Thanks for looking at this. I should perhaps originally have commented that the timed action trigger is there only for safe testing. The trigger can differ, I don't think it is really relevant to the question.
In this setup I have two Find Record steps after each other. The first finds the contact to be mailed (in production this may well be a trigger step), and the second finds the mail template to be used given the "Tag" associated with the contact.
Did that clarify?
Rgds,
Björn
Nov 12, 2024 06:08 PM - edited Nov 12, 2024 06:35 PM
The main problem is that step Find records designed to find a group of records, not a single record, so when you are trying to find a record and use field value, you get array of values instead.
Of course, you can limit the number of records found to 1, but automation setup still consider it as array of records containing 1 element.
Array can be used to fill array values (like Linked field or multiselect) or to organize loop with Repeating group.
If you want to use dynamical result to make a compare in next steps, designed for a single value, you should start from single-record trigger, like Update record, then choose record or 'use suggested' to test and then try to use it in your automation.
I guess, other problem is when you will try using value of Linked records field, because it is array too. You can solve it by formula field with CONCATENATE({Linked field name}), so array will be converted to a string.
But I think more clever solution is to use ID of 'nature' record in your Tags table instead of Linked field value.
All records having tag 'nature' linked to this record. That means their Linked field must contain that record_id
Here is actual cell value of a linked field, array of 2 objects, each contains name and id of linked record (btw you can link by pasting this id)
The type of trigger is relevant because it defines a type of value to use in further steps. Timer can just give you a few points in time (previous run, next run etc), Find records returns array of records. When record updated/enters view/matches condition - returns a single record. When webhook received - anything you put in webhook call.
Another example, it might be close to your case, where you want to use data from some record in your operation :
I need to run special update for several objects in table once in a month (in the middle of it) and I have to distribute runs in time, so the update server will not consider it as DDoS attack. I'm using part of record_id and object id as random seed and chaotic math operation returns some number x (from 0 to 999), and with DATEADD (format('YYYY-MM-12', x*15, 'minutes'), I get random points in time. In this case trigger is When record matches condition 'Hours=0' or smth like that. and then if Last update perfomed in a current month, Hours to update become 'Up to date' till next month
Here, I'm using values from trigger record in further automation steps.