Help

Re: How to link a field of another table

3431 0
cancel
Showing results for 
Search instead for 
Did you mean: 
Federica_Pasini
4 - Data Explorer
4 - Data Explorer

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!

7 Replies 7
augmented
10 - Mercury
10 - Mercury

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:

  1. Created a new automation with a trigger of “When a record is created” (you already have this probably)

  2. 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).
    image
    You need to use the gear symbol to change the “Conditions” to dynamic from static.

  3. 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
    image

  4. 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.

Federica_Pasini
4 - Data Explorer
4 - Data Explorer

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:

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.

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.)

image

You’re right :slightly_smiling_face: the second part is not working.

When a record i created:

  1. FIND: in the first I say: when you find Apple in the requests
  2. UPDATE: then update the linked record with Apple (as I use Apple as reference name in the second table)

(did i made it correct?)

it is not updating the linked record and it gives me a general error.

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!

Hi Federica. This is what my update automation looks like when I test it. Can you post a screen shot of yours?

image

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.