Help

Re: Only send Web hook to Zapier IF field is TRUE!

919 0
cancel
Showing results for 
Search instead for 
Did you mean: 
Jacob_Schwarz
5 - Automation Enthusiast
5 - Automation Enthusiast

I need a script that will run when I push a button that will check to see if a field is “TRUE” or checked and if it is, than will send the webhook out with the recordID. This will help our workflow because we want to make sure that all needed fields for a Zapier automation are present before a webhook is sent.

1 Reply 1

the basic idea would be something like this

let table = base.getTable("Table Name")

let record = await input.recordAsync("Select a record", table)

if(record && record.getCellValue("Checkbox Field") === true) {
    let url = "insert webhook url here";
    await fetch(url + "?recordID=" + record.id);
    output.markdown(`## Record sent to Zapier`)
} else {
    console.error("record not selected or value is not true")
}