diff --git a/packages/nodes-base/nodes/Hubspot/ContactDescription.ts b/packages/nodes-base/nodes/Hubspot/ContactDescription.ts index 015f3d30cf..7cd7670597 100644 --- a/packages/nodes-base/nodes/Hubspot/ContactDescription.ts +++ b/packages/nodes-base/nodes/Hubspot/ContactDescription.ts @@ -884,52 +884,6 @@ export const contactFields = [ default: 100, description: 'How many results to return.', }, - { - displayName: 'Sort By', - name: 'sorts', - type: 'options', - typeOptions: { - loadOptionsMethod: 'getContactProperties', - }, - displayOptions: { - show: { - resource: [ - 'contact', - ], - operation: [ - 'search', - ], - }, - }, - default: [], - }, - { - displayName: 'Direction', - name: 'direction', - type: 'options', - options: [ - { - name: 'ASC', - value: 'ASCENDING', - }, - { - name: 'DESC', - value: 'DESCENDING', - }, - ], - displayOptions: { - show: { - resource: [ - 'contact', - ], - operation: [ - 'search', - ], - }, - }, - default: 'DESCENDING', - description: 'Defines the direction in which search results are ordered. Default value is DESC.', - }, { displayName: 'Filter Groups', name: 'filterGroupsUi', @@ -1071,6 +1025,23 @@ export const contactFields = [ }, }, options: [ + { + displayName: 'Direction', + name: 'direction', + type: 'options', + options: [ + { + name: 'ASC', + value: 'ASCENDING', + }, + { + name: 'DESC', + value: 'DESCENDING', + }, + ], + default: 'DESCENDING', + description: 'Defines the direction in which search results are ordered. Default value is DESC.', + }, { displayName: 'Fields', name: 'properties', @@ -1095,6 +1066,15 @@ export const contactFields = [ default: '', description: 'Perform a text search against all property values for an object type', }, + { + displayName: 'Sort By', + name: 'sortBy', + type: 'options', + typeOptions: { + loadOptionsMethod: 'getContactProperties', + }, + default: 'createdate', + }, ], }, ] as INodeProperties[]; diff --git a/packages/nodes-base/nodes/Hubspot/Hubspot.node.ts b/packages/nodes-base/nodes/Hubspot/Hubspot.node.ts index c6cb238903..cf53fdd3b4 100644 --- a/packages/nodes-base/nodes/Hubspot/Hubspot.node.ts +++ b/packages/nodes-base/nodes/Hubspot/Hubspot.node.ts @@ -1171,13 +1171,13 @@ export class Hubspot implements INodeType { const additionalFields = this.getNodeParameter('additionalFields', i) as IDataObject; const returnAll = this.getNodeParameter('returnAll', 0) as boolean; const filtersGroupsUi = this.getNodeParameter('filterGroupsUi', i) as IDataObject; - const sorts = this.getNodeParameter('sorts', i) as string; - const direction = this.getNodeParameter('direction', i) as string; + const sortBy = additionalFields.sortBy || 'createdate'; + const direction = additionalFields.direction || 'DESCENDING'; const body: IDataObject = { sorts: [ { - propertyName: sorts, + propertyName: sortBy, direction, }, ],