Trigger a javascript function from a custom action in Glide

Hi Gliders, Happy new year and best wishes to you all. I’m opening this thread because I’m looking for a way to trigger a JS function from the custom ‘actions’ in Glide. Is it something that is possible? If so, can someone indicate how this can be done?

I simply want to be able to send a GET or a POST via JS when a button is pressed for ex…

Thanks a lot!

What does your JS function do? Do you expect to get back a result value inside Glide?

Hi @ThinhDinh , My JS function is just sending some variable via Get to an IP address in my local network. No, I don’t need to get any result back. I’m sending a Get to a Thermal printer with the content of what I’m printing and instructions to feed and cut paper. I noticed that it’s how this is done when using the “test page” on the Thermal printer’s interface, so that’s a shortcut I use and it’s very handy. I use the “Generate URL” column, and I have what I want when I use the “open link” action, but I don’t want to open a new window or tab everytime I print, that’s why I was hoping I can use JS instead.

Thanks a lot in advance for your time.

Hi @ThinhDinh, any idea since last time ?

Thanks a lot!


Try with this to start:


Is there a way to control this? Like does it keep sending requests or can you actually trigger it with a user action?


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



Hi! Thanks for sharing!
Using this method can we trigger Google App Scriprt and recive result from GScript? Right?

Of course, I have done this before and works fine!


I assume Glide only does a call again when the myTrigger column changes? For paid API services I don’t want that to be refreshed every 10 seconds.

Hola Thinh,

Sorry, I couldn’t follow you about this concern. If you give me more details I will appreciate it.


I mean does Glide store the cache of the result and don’t initiate any more calls until one of the inputs are changed? I don’t want to be charged for a lot of calls to a paid service just to receive the same result.

Furthermore, if X people login to the app, does it mean X calls times the number of rows you have?

1 Like

Based on some recent experimentation, the way I understand it, a javascript column is called (for all rows) when the app is initially loaded. After that, it’s called only when an input parameter changes in that particular row. Then multiply that by the number of users, since it runs locally.

So unlike a back end server, which can run something once and cache it, you will definitely have more frequent calls since the local device is doing the calling, and multiple users can be calling the code. But once an app is running, the javascript won’t run again unless an input parameter changes.


Interesting. Thanks for investigating @Jeff_Hager!


Thanks a lot Jeff!

1 Like

This is brilliant, thanks a lot @gvalero

Thanks, gvaleo!
This tricks works perfect!
Just fined is: from Glide editor it triggs twice but from browser app all ok.

Im trying to trigg some hook and to recive response:
Updated code

let myTrigger = p1;
if (myTrigger == true)  {
  const url = ``;
  const data = await fetch(url);
  const json = await data.json();   
  return json;

But filed to fetch
Im checking processed url and it works from browser but from Glide - not
Does somebody have ideas?
I tried use this three step logic:

  1. Set url
  2. wait for response
  3. Clear url and save response
    with Glide Fetch column and it works perfect. But interesting why it not worked in code column

You have to refresh trigger

Hi, Uzo!
Thanks for response!
Trigger function worked property and nook has recieved trigg, but in code column i cant recieve responce, but when i tried glide fetch column with the same url it recieving response normaly

Why do you have two await? Fetch first, then use another column to parse the JSON