Get Record retrieves a record from a database table by looking up a field. By default the Get Record function is set up to find a record based in the ID field but you can change this to any field you require.
The Get Record is a shortcut function from the Query All Records function that should be used when you are looking for a single record and know which field you want to find that record by.
- 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 getting a record from the book table based in the ID field - we are finding the book based on the value of the input: book_id.
Notice in the photo above: if you choose a field_value that maps to multiple records, then the first one found will be used.
Open the dropdown selector to choose from the other fields in the table if you wish to get a record by a different field name:
The dropdown selector allows you to choose from a different field name to get a record by.
If you need to apply a special type of sorting, or find a record based on multiple fields then you should use the Query All Records function.
The output tab of the Get Record function is similar to the Query All Records function but simplified. You can:
- Customize - Customize the response, meaning optionally pick and choose which fields you want included in the response. Use this if you only access to certain fields for your API and want to get rid of the unnecessary fields. (Fields have to be included in the response for you to access them elsewhere in your function stack).
- Variable - Choose the name for the return variable which will store the data created from the function.
In this example, you can see a preview of the response and the different options available from the output tab.
Settings allow you to add a description or comments about what your function is doing. This will be displayed on the function stack to help you see clearly what each step is performing.
Here you can add a description or comments about what the Get Record function is accomplishing.