Help

Re: Script can't access recordId in previous "create record" automation step

Solved
Jump to Solution
2012 0
cancel
Showing results for 
Search instead for 
Did you mean: 
Wookiem
5 - Automation Enthusiast
5 - Automation Enthusiast

Hello Airtable Community,

I'm encountering an issue with an automation I've set up and would appreciate any insights or advice you can offer.

Here's what I'm trying to achieve: I have an automation with two steps. The first step is a "Create Record" action, where a new record is added to a table. The second step is a script that should modify a field in the newly created record.

The problem: In the script part of the automation, I'm trying to access the ID of the record created in the first step. However, when I run the script, the variable that should hold the record ID (createdRecordId) is coming up as undefined.

Details of my setup:

  1. The "Create Record" action seems to work fine, as a new record is indeed created.

  2. In the script, I'm using input.config() to access the record ID, like this:

     
    let inputConfig = input.config();
    let createdRecordId = inputConfig.recordId;

    But createdRecordId is undefined during the script execution.

Additional Information:

  • When I check the run history of the automation, I don't see an output section for the "Create Record" action. I only see an "Input section" and a "Created a record" section.
  • I'm not sure if I'm missing a step in making the record ID available as an output from the "Create Record" action or if there's something else I'm overlooking.

Has anyone else faced this issue or have any suggestions on what I might be doing wrong? Any guidance or tips would be greatly appreciated!

Thank you in advance for your help!

1 Solution

Accepted Solutions

When you click on "Edit Code", is there a left-hand panel in the code editor? That's where you would configure the input variables.

Andy_Lin1_0-1700588259447.png

 

See Solution in Thread

5 Replies 5

Hello @Wookiem 

Have you passed input variable as recordId with its value?

Not sure but maybe you didn't pass it.

Just share some screenshot, which makes more sense.

Wookiem
5 - Automation Enthusiast
5 - Automation Enthusiast

Automation - Create Record.pngAutomation - Script.png

Wookiem
5 - Automation Enthusiast
5 - Automation Enthusiast

Thanks Dilipboard.

No, I couldn't figure out how to configure either the output from add record step and the input to the script.  Please let me know what I'm missing.  Thanks!

 

Automation - Script 1.png

When you click on "Edit Code", is there a left-hand panel in the code editor? That's where you would configure the input variables.

Andy_Lin1_0-1700588259447.png

 

Wookiem
5 - Automation Enthusiast
5 - Automation Enthusiast

Thanks Andy_Lin1!  That solved it for me.