Edit record will update an existing record. Editing a record is a full object replacement, which means the data you update the record with will replace the existing data.
At times you may wish to update a record by merging new data with existing data. To do this you you will need to first get the existing data, manipulate it to include the new data then update the record using the edit record function.
Other times, you may wish to update a field of a record only if the input for that field has a value. You can use conditional logic or conditional filters to conditionally edit the fields of a record.
The Edit Record function finds the record to update based on a single field look up. By default, this field is set to the ID but you can change it to any field you want.
Finding the record:
- 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.
In this example, we are finding a record to edit based on the id field. The record we find will have the value of the input product_id.
The metadata is the section that contains the different fields of the record from your database table.
You can choose to ignore or hide a field if you do not wish to update it at all by toggling the icon in the top right corner of the field name box.
The magic wand allows you to apply a single variable to all the fields at one time. This is useful when you have many fields and you are getting all or most of the data from the same variable.
The Metadata is where you map fields to the data you want to update them by. You can ignore a field by toggling the eye icon. Additionally, you can apply a single variable to all the fields with the magic wand.
The output is what data is returned in the return variable as a result of the function. You can customize which fields are to be included, use Addons to extend the data, or customize the name of the return variable.
The output tab shows a preview of the response of the function and different options to manipulate it.
Settings allow you to add a description to the function. This will be displayed in the function stack to help you understand each step when you have complex function stacks.
Optionally add a description to the function to help understand what this step is doing.