record_create
Use this action to create a record in a database app from an automation.
Read the live config shape of each action type from GET /v1/automation/meta/action before you build on it.
In the automation editor, this action is Create a record in the Current record family. Its group is action, and it works with every trigger.
Send it in the actions array of Create an automation or Update an automation. An update replaces the whole array, so include the other actions.
Example
When a deal is won in a CRM, this action creates a kick-off task in the Tasks database app:
{
"type": "record_create",
"config": {
"app_id": 4021,
"field_assignments": [
{
"field_type": "single_text",
"variable_def": { "kind": "variable", "source": "field", "field_id": 51207, "field_type": "single_text", "previous": false, "collection": false, "triggering": false },
"assignment_type": "set",
"field_value": ["Kick-off call for deal ", { "kind": "variable", "source": "meta", "meta_type": "app_record_id", "app_id": 87 }]
},
{
"field_type": "single_category",
"variable_def": { "kind": "variable", "source": "field", "field_id": 51208, "field_type": "single_category", "previous": false, "collection": false, "triggering": false },
"assignment_type": "set",
"field_category_option_id": 3
}
],
"author_id": { "kind": "variable", "source": "meta", "meta_type": "created_by", "app_id": 87 },
"trigger_other_flows": false
}
}
Config
| Property | Type | Description | Example value |
|---|---|---|---|
app_id | integer | ID of the database app Tape creates the record in. | 4021 |
field_assignments | array of field assignments | Values Tape writes into the new record, one entry per field. Left out or [], Tape creates an empty record. | [] |
author_id | integer | reference | User Tape attributes the new record to: a user ID, or a reference to the creator, the last modifier or a user field. Left out, the automation itself is the author. | 812 |
trigger_webhooks | boolean | Whether the new record fires outbound webhooks. Default false. | false |
trigger_other_flows | boolean | Whether the new record starts other automations. Default false. | false |
silent | boolean | Whether Tape sends no notifications for the new record. Default false. | true |
To find app_id and the field IDs, see App and field IDs. To find the option ID for field_category_option_id, see Retrieve a single app. It returns the options in config.settings.options of the field.
author_id, trigger_webhooks, trigger_other_flows and silent are shared by every action that changes records. In the action menu of the automation editor, they are Author, Trigger webhooks, Trigger automations and Silent. To find a user ID for author_id, see Retrieve organization users.
Field assignments
Each entry of field_assignments sets one field of the new record. There are 20 assignment shapes, one per field type. They share these members:
field_type(required): the type of the target field, for examplesingle_textorsingle_category. It selects the shape of the entry.variable_def(required): a field reference to the target field, withsource: "field",field_idandfield_type.assignment_type: how Tape produces the value. The modes depend on the field type. Asingle_textentry takesset,unsetorset_code.- A value member that fits the mode:
field_valueforseton a text field,field_category_option_idforseton a category field,codeforset_code.unsetcarries no value. id: stable ID of the entry. Tape creates one when you leave it out and returns it on read.
meta/action describes the populated shape only loosely. Copy the shapes from the example above and check the live config_schema before you send filled assignments.
Use the new record in a later action
A later action reads the new record with a created_record reference. With "property": "id", it returns the record ID:
{ "kind": "variable", "source": "action", "action_type": "created_record", "app_id": 4021, "property": "id" }
General behavior
- No key is required by the schema. Send
app_idanyway. Without it, the action saves but creates no record. - An
app_idof a deleted app gives the broken reasonaction_app_missing. Anapp_idthat never existed makesvalidateand activate return404. - Tape refuses an entry with
400when its mode needs a value that the entry doesn't send. For example,setwithoutfield_valueon a text field. - Without
author_id, the automation itself is the author. A user ID that Tape can't find gives the broken reasonaction_user_missing. - Tape returns
silenton every read. It'sfalsewhen you left it out. - Keep
trigger_other_flowsatfalseto avoid a loop when the automation triggers on the same database app.
Requirements
- To add or change this action through the API, your token needs the
automations:editcapability. See Capabilities. - You must administer the workspace that the automation's database app belongs to.
- The target database app must exist in your organization.