Help

Need help with a script that is triggered by a button on interface

Solved
Jump to Solution
1049 2
cancel
Showing results for 
Search instead for 
Did you mean: 
SeanSacdalan
4 - Data Explorer
4 - Data Explorer

Objective: I am trying to create an Airtable automation that triggers a script to increment a "Revision Number" field each time a button is clicked. The button is configured in an Airtable interface.

Expected Behavior: When the button is pressed, the automation should trigger a script that receives the record ID as an input variable. The script should then fetch the record from the "Quotation" table, increment the "Revision Number" by 1, and update the record.

Issue Encountered:

  • Error Message: The script continually logs that no record ID is provided ("No record ID provided."), indicating that the recordId input variable is undefined.
  • Script Setup: The script is set to fetch the record ID passed from the automation trigger (button press) and use this ID to locate and update the specific record.
  • Automation Configuration: The automation is triggered by a button press in an interface, and it's supposed to pass the record ID to the script.

    Steps Taken:

    • Verified that the automation trigger is correctly set to "When button pressed."
    • Configured the script to accept a recordId as an input variable, expecting it to be passed from the trigger.
    • Ensured the button is meant to interact with records and should provide a record ID.
    • Checked and re-checked the input variable configuration to ensure it's correctly set to capture and pass the "Record ID" from the trigger.

      Additional Context:

      • The script uses console.log to output the received recordId for debugging, which consistently shows as undefined.
      • The table involved is named "Quotation", and the field to be incremented is "Revision Number".

        Assistance Requested:

        • Suggestions on ensuring the record ID is passed correctly from the button press to the script in automation.
        • Verification on whether there might be a configuration or a limitation in Airtable that I might be missing.
        • Any known issues with button-triggered automations in interfaces not correctly passing record data.
1 Solution

Accepted Solutions
Dan_Montoya
Community Manager
Community Manager

You don't show if you are passing in the input variables so my guess is that is missing.  However, you don't need code to do this.  Example BaseScreenshot 2024-04-26 at 8.11.15 PM.png

 

 

See Solution in Thread

2 Replies 2
Dan_Montoya
Community Manager
Community Manager

You don't show if you are passing in the input variables so my guess is that is missing.  However, you don't need code to do this.  Example BaseScreenshot 2024-04-26 at 8.11.15 PM.png

 

 

SeanSacdalan
4 - Data Explorer
4 - Data Explorer

How did I not see this 🤦🏻‍♂️ Thank you so much Dan! You saved me how many hours of researching on another answer