TwentyDEV icon

TwentyDEV

Consume the Twenty API

Actions252

Overview

This node operation allows you to create a new "View Sort" configuration in the target system. A "View Sort" defines how data within a specific view should be ordered based on a particular field and direction (ascending or descending). This is useful when you want to programmatically control the sorting behavior of views, for example, to ensure that users see data sorted by priority, date, or any other relevant field automatically.

Practical examples include:

  • Automatically setting a default sort order for a dashboard or report view.
  • Creating custom sorts for different user roles or contexts.
  • Dynamically adjusting sort criteria based on external triggers or workflows.

Properties

Name Meaning
Depth Determines the level of nested related objects included in the response:
- 0: Only primary object info.
- 1: Primary object + directly related objects.
- 2: Primary + directly related + their related objects.
View Id The identifier of the view where the sort will be applied.
Direction The direction of the sort. Typically this would be values like ascending or descending (the exact allowed values depend on the API but are not explicitly listed here).
Field Metadata Id Required. The identifier of the field on which the view sort will be based. This specifies the target field used for sorting.

Output

The node outputs JSON data representing the newly created View Sort object as returned by the API. This typically includes details such as the sort's unique ID, the associated view ID, the field metadata ID, the direction of the sort, and possibly related nested objects depending on the Depth parameter.

No binary data output is indicated.

Dependencies

  • Requires an API key credential to authenticate requests against the target service.
  • The base URL for the API is configured via credentials.
  • The node sends HTTP requests with JSON payloads and expects JSON responses.

Troubleshooting

  • Missing required fields: If the "Field Metadata Id" or "View Id" is missing or invalid, the API will likely return an error indicating a bad request. Ensure these IDs are correct and provided.
  • Invalid direction value: Providing an unsupported sort direction may cause the API to reject the request. Verify allowed values for the direction property.
  • Authentication errors: If the API key or domain credentials are incorrect or expired, authentication will fail. Check credential validity.
  • Depth parameter misuse: Setting an unsupported depth level might result in incomplete or unexpected response data.

Links and References

  • Refer to the target API documentation for detailed information about the "View Sort" resource and its properties.
  • Consult the API docs for valid values for the "Direction" property and examples of usage.
  • n8n documentation on creating custom nodes and using API credentials.

Discussion