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
}
Related to this thread -- we just launched a closed alpha for Sync Functions Let me know if you'd like to be added!
Best,
Erin
Update: The closed beta for resource functions and sync functions has concluded, and the feature is not being enabled for additional organizations. No further improvements or bug fixes will be made. See the Legacy: Resource and sync functions docs for details.
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.
Update: The closed beta for resource functions and sync functions has concluded, and the feature is not being enabled for additional organizations. No further improvements or bug fixes will be made. See the Legacy: Resource and sync functions docs for details.