Help

Save the date! Join us on October 16 for our Product Ops launch event. Register here.

Re: Run a script as an action in Automations cannot take recordId as an input

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

Trying to update additional fields of an updated record accordingly.

Getting “undefined” value for recordId. What would be the problem?

let recordId = input.config().recordId;
console.log(recordId);

let rootTable = base.getTable('uretim-kaydi');
let rootQuery = await rootTable.selectRecordsAsync();
let record = rootQuery.getRecord(recordId);

Screen Shot 2021-06-11 at 21.07.25

1 Solution

Accepted Solutions
Ubeyd_Gungor
5 - Automation Enthusiast
5 - Automation Enthusiast

Sorry to bother, I didn’t see the left column of “input variables”. I created an input variable there and it’s ok now.

See Solution in Thread

3 Replies 3

Try

let {recordId} = input.config()

and make sure you’ve created an input config variable by the name recordId

Ubeyd_Gungor
5 - Automation Enthusiast
5 - Automation Enthusiast

It is a script as an action within an automation. I don’t see an option to create an input config variable.

Also, when I tried this, I get the error below:

let config = input.config();

let {recordId} = config.recordId;

console.log(recordId);

ERROR

TypeError: Cannot destructure property ‘recordId’ of ‘config.recordId’ as it is undefined.

at main on line 11

Ubeyd_Gungor
5 - Automation Enthusiast
5 - Automation Enthusiast

Sorry to bother, I didn’t see the left column of “input variables”. I created an input variable there and it’s ok now.