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

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

Try

let {recordId} = input.config()

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

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

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

This topic was solved and automatically closed 3 days after the last reply. New replies are no longer allowed.