Skip to main content
Solved

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

  • June 11, 2021
  • 3 replies
  • 32 views

Forum|alt.badge.img

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

Best answer by Ubeyd_Gungor

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

3 replies

Kamille_Parks11
Forum|alt.badge.img+27

Try

let {recordId} = input.config()

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


Forum|alt.badge.img
  • Author
  • New Participant
  • 2 replies
  • June 11, 2021

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


Forum|alt.badge.img
  • Author
  • New Participant
  • 2 replies
  • Answer
  • June 11, 2021

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