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…
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.
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?
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.
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 = `https://vektor-systems.bitrix24.ru/rest/13/4825o4an22hrm2o4/crm.contact.list.json?FILTER%5BPHONE%5D=79605463333&SELECT%5BID%5D=`;
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?
Thanks!
Upd:
I tried use this three step logic:
Set url
wait for response
Clear url and save response
with Glide Fetch column and it works perfect. But interesting why it not worked in code column
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