Feb 07, 2024 12:23 PM
I am NOT a coder... but this process is slowly making me one (sometimes to my regret).
I am trying to put together a script triggered by a change in a field titled "Invoicing?" on a table named "ALL INVOICES 2024" that will update a different table titled "Client Overview" by adding "Offboard/Last Inv" to a field named "Active/Inactive." These two tables are NOT linked to each other and I don't want them to be, but they do have one field that is identical between the two of them: "Client ID."
After banging my head against a wall for about two days, I decided to just backtrack to the most basic tutorial to see how I might put this together. My first task to "learn" is how to make Airtable identify the record that triggered the script to run.
I stripped down to the easiest of tasks: Output the Record ID of the table that caused the trigger. I used a bit of code from this article: https://www.airscript.dev/2021/01/31/airtable-automations-scripts
let inputConfig = input.config();
console.log(`Record ID is, ${inputConfig.recordId}`);
I have identified Record ID in the Input Variables sidebar:
But on test, I am getting "Record ID is, undefined"
I have literally copy/pasted the exact code from the article and I believe I did every step to define the input variable or Record ID. What am I doing wrong?
Solved! Go to Solution.
Feb 07, 2024 04:13 PM
Feb 07, 2024 03:34 PM
Hi @OpsLHPA,
Javascript also takes care of capitalization.
If there is a space in the name of the input value, it must be enclosed in quotation marks.
let inputConfig = input.config();
console.log(`Record ID is, ${inputConfig["Record ID"]}`);
// If input value name were "recordID", it would be simpler.
let inputConfig = input.config();
console.log(inputConfig.recordID);
// OR
let {recordID} = input.config();
console.log(recordID);
Feb 07, 2024 03:40 PM
Thanks. I figured so, but the spaces were as they were printed in the article. I have, however, adjusted it to your shortened version. I am still getting an "undefined" result of the test.
Feb 07, 2024 04:13 PM
Just change this to "recordID" here.
Feb 08, 2024 10:51 AM
Aha! As Daffy Duck would say... "pronoun trouble...."
Thank you!