Actions111
- Item Actions
- Webhook Actions
- Collection Actions
- File Actions
- Activity Actions
- Asset Actions
- Authentication Actions
- Extension Actions
- Field Actions
- Folder Actions
- Permission Actions
- Preset Actions
- Relation Actions
- Revision Actions
- Role Actions
- Setting Actions
- User Actions
- Utility Actions
Overview
The "Sort Items" operation under the "Utility" resource is designed to reorder items within a specified collection. This node is useful in scenarios where you need to programmatically change the order of records, such as rearranging articles, products, or any sortable entities in a database or content management system. For example, you might use this node to move a blog post to a different position in a list or to update the display order of items in an e-commerce catalog.
Properties
| Name | Meaning |
|---|---|
| To | Primary key of the item where you want to move the current item to. |
| Item | Primary key of the item that you want to move. |
| Collection Name | Identifier for the collection containing the items. Options are dynamically loaded. |
Output
- The output will be a JSON object reflecting the result of the sort operation. It typically includes confirmation of the action and may echo back the affected items and their new positions.
- No binary data is produced by this operation.
Dependencies
- May require access to an external service or database (such as Directus) where the collections and items are managed.
- Proper authentication or API keys may be necessary depending on your n8n and backend configuration.
Troubleshooting
- Common Issues:
- Invalid primary keys for "To" or "Item" may result in errors or no changes being made.
- Specifying a non-existent collection name will likely cause the operation to fail.
- Error Messages:
- "Item not found": Ensure the provided primary key exists in the selected collection.
- "Collection not found": Verify the collection name is correct and accessible.
- "Permission denied": Check user permissions and API credentials.
Links and References
- n8n Documentation
- Directus Documentation (if applicable)
- How to Use Utility Nodes in n8n