You may want to create your own functions, in addition to what is auto-generated when you connect a data source. Custom functions (for a database) allow you to bulk update multiple records, based on filter criteria you define. Currently you can create custom functions for PostgreSQL, MySQL, and Cassandra data sources.
To create a custom function for a database, first navigate to Company Settings → Data Sources. Click on the desired data source.
Under “Functions", click on “Add New”. You can also go to the Function Library and click “+Function” with a data source selected.
Name your function, then select the data source the function interacts with.
There are three types of actions that your custom function can perform:
Then select the resource you want this function to act on.
(only appears for Update and Delete actions)
You’ll use filters to identify the particular records you want the function to act on.
First, select the fields that you want to filter on, then choose how you want to compare ("greater than", "is equal to", "contains", etc). Finally enter in the comparison value.
Note: there are some edge cases in how we convert to template literal, please see the dynamic parameters documentation for details.
Click "X" to remove a filter and "+Add filter" to add more filters. Each filter is an “AND” statement - records must pass all filter criteria in order to be acted upon.
(only appears for Insert and Update actions)
This allows you to set new values for the fields you specify.
This checkbox provides an additional safety net in case you do not intend for this function to perform bulk update actions. If this is unchecked, the function will fail if it attempts to act on more than one record.
Hit “Apply” to create your function.
Note: You’ll configure how values for your dynamic parameters are populated when you use this function in a component.