Is it possible to create a reusable function, see example below, that can be called with arguments within a component? I am attempting to format multiple values in different components placed on a single retool page while trying to do so without having to redefined the function within each component.
It would be ideal if I can do something like this {{ reusableFunction(selectedRow.col1.value, selectedRow.col2.value) }} for each applicable component rather than this {{ selectedRow.col1.value + selectedRow.col2.value }}.
resource - reusableFunction
function reusableFunction(arg1, arg2) {
return arg1 + arg2
}
Hello all, this is Retool from the future! Earlier this year in March 2025, we launched App Functions Beta, which is the updated version of the Sync Functions Erin mentioned above.
App functions enable you to write reusable logic with dynamic parameters. Use functions when you want to perform the same actions on different pages, with different parameters, and return different data.
We’ve made updates in the app around how to write reusable logic, so check out the latest docs on App Functions! This feature is currently in beta, so let us know if you’d like to be added!