Add or Edit Record is a unique function that performs the following:
Look for a record, if the record does not exist then add it to the database, if it does exist then update the record.
The function will search through a database field for a record based on a specified field. If it does not find a matching record then the function will add a new record. If it finds an existing record, then it will update that record with the mapped data.
One common use case for this function is when you are storing data from an external API in the database and this data sometimes has new information - whether that be updated records or new records.
Finding a record by field:
Field name: This is the name of the field (column) in your database table that you want to find the record by. Field name will be defaulted to the ID field but you can open the dropdown selector to choose from the list of different fields in the database table.
Field value: This how you find the record based on the value of the field name. The field value is typically an input but can also come from things like a variable or the authenticated user ID.
Choose which field to look up a record by with field_name. Field_value will determine the value of that field to look up the record.
This is where you can map the fields to the data you wish to add or edit a record. Often times this is dynamic data in the form of inputs or outputs.
You can hide fields that you do not wish to add or edit by toggling the eyeball icon in the top-right of the field name boxes. Additionally, you can quickly select all the fields to hide by selecting the eyeball icon at the top of the metadata section.
The magic wand icon allows you to apply a single variable to all the fields below. This is helpful when you have many fields and are grabbing the data from a variable coming from something like an external API or webhook.
You can hide fields that you do not want to add or edit. You can also quickly apply a single variable to all the fields. Also note that you can add filters to the input values for on the fly data transformation.
The output is the Response of the Add or Edit record function. There will be a preview of the response, which you can customize or include an Addon to extend the data. The response will be contained in the return variable, which you can customize the name of at the bottom of the output tab.
The output tab lets you customize the response, extend the response with addons, and choose the name of the return variable.
Settings allow you to add a description for the function to be displayed in the function stack.