Pricing Blog

Formulas vs custom actions

  • nathandh.-1419650958387839108

    nathandh

    22 days ago

    Silly question probably, but watching the new Speed Run vids (which are awesome, great work @salma), and I’m wondering:

    What’s the difference between formulas and custom actions? Seems like both are reusable logic bits, with or without custom JS.
  • jaycmpb-1419660611620700230

    Jay Campbell

    22 days ago

    Hi @nathandh 👋🏾,

    Formulas are essentially synchronous (don't have to await anything) JavaScript functions that manipulate data. Say I needed something to calculate tax that would take an input, add the percentage, and then return that value—you'd use formulas for that. They can only be used in the formula view, not as an action.

    Custom actions on the other hand can be asynchronous but also allows you to send events to Nordcraft. Say I want to fetch data from an external API and I want to have events that will trigger when it's successful and when it fails so that I can change things in the UI—that's what custom actions would be for. They can only be used as an action, not in the formula view.
    🙏2