Help

The Community will be temporarily unavailable starting on Friday February 28. We’ll be back as soon as we can! To learn more, check out our Announcements blog post.

Why won't this script work when triggered by a button?

614 0
cancel
Showing results for 
Search instead for 
Did you mean: 
Alix
5 - Automation Enthusiast
5 - Automation Enthusiast

I want to send a webhook when a button is pressed on a record :

// Use recordAsync to get the record associated with the button
let record = await input.recordAsync();

// Check if the record exists
if (record) {
// Construct the URL based on the fetched record ID
let url = `https://hooks.airtable.com/workflows/v1/genericWebhook/appXXXXXX/wflXXXXXX/wtrXXXXXX/${record.id}`;

// Fetch data from the constructed URL
await fetch(url);
} else {
console.error("Record not found");
}

but I'm getting this error:

ERROR

TypeError: Invalid arguments passed to input.record(label, source, options): • label should be a string, not undefined • source → source should be a Table, not undefined or source should be a View, not undefined or source should be a RecordQueryResult, not undefined or source should be an array, not undefined
    at main on line 2


Can anyone help here please? (I don't know scripting)

0 Replies 0