Save the date! Join us on October 16 for our Product Ops launch event. Register here.
Feb 17, 2022 07:16 AM
Hello,
What I am trying to do (unsuccessfully) is to link one field within one table to another table.
Let’s say that every time someone is filling in a form asking for apples in table 1, the apple sellers in table 2 should receive an email with the request details.
I already automated the email and communication part adding the lookup fields, but I do totally miss the automatisation that connect the line one: apple request with the lookup field in table 2: apple seller.
Can you help me?
thanks!
Feb 17, 2022 12:16 PM
Ciao Federica. My first reaction was to say “yes, this should be easy”. Then, realizing I might be overconfident, I went and built a test version of this. What I did was the following:
Created a new automation with a trigger of “When a record is created” (you already have this probably)
Created a “Find records” action where you are looking to match the form field where “apples” are selected, for example, with the field in table 2 describing the provider type (apple seller).
You need to use the gear symbol to change the “Conditions” to dynamic from static.
Then, I created a conditional action that updates the the linked field in table 1 (for the new form-entered record) with the table 2 records found in the “Find records”, if any records were found
At this point, I would add another conditional action in the same block to send the emails to the providers found in table 2.
Whew! I hope that makes sense.
Feb 18, 2022 06:44 AM
Thanks!!
at the moment is not working :frowning: I’m wondering whether is about the setting of table 2. I’ve also tried to use the same wording or to update different records, not linked :frowning:
Feb 18, 2022 11:49 AM
Hi Federica. What part isn’t working? Are you finding the records in table 2 that you expect? Are you able to update the link field in table 1 with those record ids?
I’m willing to help but I need to know a little more, I think.
Feb 18, 2022 02:05 PM
Hi,
I suppose the challenging part is that you need single record for Send Mail step, while Find Records output is ‘array of record IDs’. Even if it’s 1 element array, it’s still array.
The first solution is - set linked field between tables, but leave it empty. After Find Records, set next step Update record, and put result of ‘Find Records’ (array of IDs) inside that linked field of record 1.
Now set up second automation, which triggers at ‘link field non-empty’ in table 2, and then Send Mail.(and then clean link field, maybe, if you want to reuse this address)
Btw, using such trick you may not only Send Mail but ‘update many records by single automation run’ (technically, that’s impossible, but here 1st automation ‘marks’ records and second - do multiple runs with each of the marked.
Second way, no field needed, but you need to install ‘one line script’ (if your plan lets you do it)
After Find Records, use array method ‘find’ which finds first single value that meets criteria (if my example criteria is always true). Put that value in variable ‘seller’. Now seller = single record id
In next step. you need to get this record. so, you need to set Update step. Thats strange step, you need to update ‘something’ without really need to update. Maybe even add dummy empty field and put ‘nothing’ there. Or add ‘maillog’ and put ‘mail sent’ there
Nest step, you can set Send Mail, using record from previous step,
(note that if you have probability of not find any records, you should think about conditional steps, because if you feed script with null, it throws an error.)
Feb 21, 2022 12:48 AM
You’re right :slightly_smiling_face: the second part is not working.
When a record i created:
(did i made it correct?)
it is not updating the linked record and it gives me a general error.
Feb 21, 2022 04:55 AM
Hi Alexey,
my “issue” is that the update feature is not working as it should (and I don’t know if it is because I want to update automatically a Linked field).
thanks!
Feb 21, 2022 06:04 AM
Hi Federica. This is what my update automation looks like when I test it. Can you post a screen shot of yours?
The “Record ID” is from the trigger step - newly created via your form. I have my table names backwards from yours. In this case, “Table 1” is the linked field in your Table 1 that links it to the produce vendors (your Table 2). You are updating this field with a list of Airtable record IDs from the “Find records” step. Finally, you see the test of this update is successful.