Help

Problem with input.config

Topic Labels: Automations
952 4
cancel
Showing results for 
Search instead for 
Did you mean: 
PauB
5 - Automation Enthusiast
5 - Automation Enthusiast

Hello everyone,

I did a trigger "When record is created" and script action where i want to get the record id to be able to update the record and all stuff. To do it, I'm using input.config() but not doing well in input variables. As shown in the picture, I've created an input variable named recordId and the value should let me choose something like "Record (from step 1)" that should be the record id of the trigger. I've never used this before and I'm a bit lost. Thank you all in advance.

 

Captura de pantalla 2024-07-30 185403.png

 

4 Replies 4

Pick "Airtable record ID", the third item in the menu in your screen shot, to get the record ID.

The "Use data from..." section lets you pick the triggering record or a previous action, if there was one. Then the "Choose data" lets you pick which specific piece of data from the triggering record or previous action.

It's very similar to Zapier, but the terminology is slightly different.

PauB
5 - Automation Enthusiast
5 - Automation Enthusiast

Thanks for your fast reply! I've just picked "Airtable record ID" but there's still an error in declaration of the recordId.

Captura de pantalla 2024-07-30 192629.png

 

Sometimes the editor puts in wavy red underlines even though the script runs fine as is. This may be the situation. Also, sometimes the editor takes a while to catch up to changes in how input variables are defined and sometimes the wavy red underlines disappear after closing and reloading the editor.

Try running the script and see if it does what you expect.

shortsfareed
4 - Data Explorer
4 - Data Explorer

Hello! It sounds like you're on the right track by using `input.config()` to retrieve the record ID in your script. To make sure you're selecting the correct input variable, here's what you can do:

1. In your automation, after creating the trigger "When record is created," ensure that the `recordId` input variable is properly set up in the script action.
2. When defining the input variable, make sure the type is set to "Record" and choose "Record (from step 1)" as the source.
3. In your script, you can access this record ID using `input.config()` like this:

```javascript
let recordId = input.config().recordId;
```

This should give you the record ID from the trigger, allowing you to update the record or perform any other actions needed. If you're still having issues, double-check that the input variable is correctly linked to the trigger output. Let me know if you need any more help!