Trigger a javascript function from a custom action in Glide

Sure,

Just create an additional conditional sentence (If - then) to control the execution code:

let myTrigger = p1;        //  p1 is the 1st parameter
if (myTrigger == True)  {
    var data= await fetch('YOUR_URL', {
       method: 'POST',
        headers: {
           'Content-Type': 'application/x-www-form-urlencoded',
           'Authorization': 'YOUR_BearerToken'
        },
    });
    const json = await data.text();    //  or  data.json();   
    return json
  }

Now, you can create a custom action using the new Wait Action feature to get it:

  1. Set True to code’s trigger (“myTrigger” as parameter/column)
  2. Wait 2-3 sec to allow the JS to run
  3. Set False to code’s trigger to disable next executions

Saludos!

2 Likes