Skip to main content

How to remotely run an extension

  • December 24, 2024
  • 4 replies
  • 5 views

Forum|alt.badge.img+5

I need to automatically trigger a script that makes use of `Field.updateOptionsAsync`to add options to my single-select field. I first wrote this as an automation script so I could easily set up a trigger, but saw this API is only allowed in scripting extensions. So then, I wrote it as a script extension and couldn't figure out how to automatically trigger it to run. So then I found out about block-cli and released the extension to my base because I misunderstood that `block run --remote` does not run the extension remotely, leaving me with 2 extensions that do the exact same thing. So:

  1. Is it possible to run extensions remotely / trigger them to run automatically? How so if it is?
  2. Can we get the ability to use `updateOptionsAsync` in an automation script?
  3. Is there yet another way to achieve what I am trying to do?

 

4 replies

Alexey_Gusev
Forum|alt.badge.img+23
  • Brainy
  • 1131 replies
  • December 24, 2024

Hi,
I'm not sure it's the best workaround for this, but I described how I solved the problem HERE.
In short, automation can add option when you update record with the new value. So I did dedicated automation for this, triggered by webhook.


TheTimeSavingCo
Forum|alt.badge.img+28

re: Is it possible to run extensions remotely / trigger them to run automatically? How so if it is?

Not at this time I'm afraid

---

re: Can we get the ability to use `updateOptionsAsync` in an automation script?  Is there yet another way to achieve what I am trying to do?

Kind of; we can create new options via a POST / PATCH call within an automation script to the same base.  This exposes your API key to anyone who has access to the base though, and you also can't set the color of the option either


Forum|alt.badge.img+5
  • Author
  • New Participant
  • 1 reply
  • January 4, 2025
TheTimeSavingCo wrote:

re: Is it possible to run extensions remotely / trigger them to run automatically? How so if it is?

Not at this time I'm afraid

---

re: Can we get the ability to use `updateOptionsAsync` in an automation script?  Is there yet another way to achieve what I am trying to do?

Kind of; we can create new options via a POST / PATCH call within an automation script to the same base.  This exposes your API key to anyone who has access to the base though, and you also can't set the color of the option either


Can you give me an example of how I would use a POST/PATCH within an automation script? I am the only one with access to my base and I do not need to set the color of my single select options.


TheTimeSavingCo
Forum|alt.badge.img+28
blopez12 wrote:

Can you give me an example of how I would use a POST/PATCH within an automation script? I am the only one with access to my base and I do not need to set the color of my single select options.


Hmm this is the JSON I'd send:

{ "fields": { "Status":"New option" }, "typecast": true }

And I'd use it in either a create records or update records request:
https://airtable.com/developers/web/api/create-records
https://airtable.com/developers/web/api/update-record

Sorry, I'm not too sure what you're asking!


Reply