Actions118
- Item Actions
- Activity Actions
- Asset Actions
- Authentication Actions
- Collection Actions
- Extension Actions
- Field Actions
- File Actions
- Folder Actions
- Permission Actions
- Preset Actions
- Relation Actions
- Revision Actions
- Role Actions
- Server Actions
- Setting Actions
- User Actions
- Utility Actions
- Webhook Actions
Field → Create
AI-generatedOverview
This node creates a new field in a specified collection within a Directus database. It is useful for dynamically adding fields to collections during automation workflows, such as adding custom attributes to content types or user data. For example, you can create a new 'firstName' field of type 'string' in the 'articles' collection.
Use Case Examples
- Create a 'firstName' string field in the 'articles' collection to store author names.
- Add a 'publishedDate' field of type 'dateTime' to a blog posts collection to track publication dates.
Properties
| Name | Meaning |
|---|---|
| Name | The name of the field to be created in the collection. |
| Collection Name | The target collection in which the new field will be created. |
| Type | The data type of the field, which determines how values are cast and stored in the Directus database. |
| JSON/RAW Parameters | Whether the body parameters should be set via the UI or as raw JSON/RAW. |
| Body Parameters | The body parameters for the field creation request, provided as JSON or RAW format. |
Output
JSON
field- The name of the created field.collection- The collection where the field was created.type- The data type of the created field.bodyParameters- Additional parameters sent in the request body for field creation.
Dependencies
- Directus API with appropriate authentication credentials
Troubleshooting
- Ensure the collection name exists and is spelled correctly to avoid errors.
- Verify that the field name is unique within the collection to prevent conflicts.
- Check that the data type selected is supported by Directus and matches the intended use.
- If using JSON/RAW parameters, ensure the JSON syntax is valid to avoid parsing errors.