@trg-admin/n8n-nodes-zoho-desk 0.1.25 → 0.1.26

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -42,13 +42,18 @@ function readDepartmentScope(context) {
42
42
  catch {
43
43
  // Not available in this context; fall through.
44
44
  }
45
- // Nested: on update, Department lives in the Additional Fields collection. Values inside
46
- // a collection are invisible to getCurrentNodeParameter, so read the raw parameters.
45
+ // Fall back to the raw parameters: on create the value is also top-level, but this keeps
46
+ // the reader working if Department is ever nested inside a collection again.
47
47
  try {
48
- const nested = ctx.getCurrentNodeParameters?.()?.additionalFields
49
- ?.departmentId;
50
- if (nested !== undefined && nested !== null && nested !== '') {
51
- return String(nested).trim();
48
+ const raw = ctx.getCurrentNodeParameters?.();
49
+ const candidates = [
50
+ raw?.departmentId,
51
+ raw?.additionalFields?.departmentId,
52
+ ];
53
+ for (const candidate of candidates) {
54
+ if (candidate !== undefined && candidate !== null && candidate !== '') {
55
+ return String(candidate).trim();
56
+ }
52
57
  }
53
58
  }
54
59
  catch {
@@ -234,6 +239,22 @@ class ZohoDesk {
234
239
  displayOptions: { show: { resource: ['ticket'], operation: ['create'] } },
235
240
  description: 'Department to assign ticket to. Make sure Organization ID is filled in first.',
236
241
  },
242
+ {
243
+ // Scopes the Classification / Category / Sub-Category / Channel dropdowns to one
244
+ // department's layout. Left blank, those dropdowns list the whole organization.
245
+ // Kept top-level rather than inside Additional Fields so it is visible without
246
+ // expanding the collection. Note: sending it also moves the ticket.
247
+ displayName: 'Department',
248
+ name: 'departmentId',
249
+ type: 'options',
250
+ typeOptions: {
251
+ loadOptionsMethod: 'getDepartments',
252
+ loadOptionsDependsOn: ['organizationId'],
253
+ },
254
+ default: '',
255
+ displayOptions: { show: { resource: ['ticket'], operation: ['update'] } },
256
+ description: "Department whose layout defines the values offered by the Classification, Category and Sub-Category fields below. Leave blank to list values from every department in the organization. Note: setting this also moves the ticket into that department, so set it to the ticket's current department unless you intend to move it.",
257
+ },
237
258
  {
238
259
  displayName: 'Description',
239
260
  name: 'description',
@@ -269,20 +290,6 @@ class ZohoDesk {
269
290
  default: 'Email',
270
291
  description: 'Channel through which the ticket was received or created, scoped to the selected Department. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
271
292
  },
272
- {
273
- // Create already has a top-level required Department, so only offer this
274
- // here for Update - it both scopes the taxonomy values and moves the ticket.
275
- displayName: 'Department',
276
- name: 'departmentId',
277
- type: 'options',
278
- typeOptions: {
279
- loadOptionsMethod: 'getDepartments',
280
- loadOptionsDependsOn: ['organizationId'],
281
- },
282
- default: '',
283
- displayOptions: { show: { resource: ['ticket'], operation: ['update'] } },
284
- description: 'Department whose layout defines the values offered by the Classification, Category and Sub-Category fields below. Leave blank to list values from every department in the organization. Note: setting this also moves the ticket into that department, so set it to the ticket\'s current department unless you intend to move it.',
285
- },
286
293
  {
287
294
  displayName: 'Classification',
288
295
  name: 'classification',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trg-admin/n8n-nodes-zoho-desk",
3
- "version": "0.1.25",
3
+ "version": "0.1.26",
4
4
  "description": "Community n8n node starter for Zoho Desk using built-in Zoho OAuth2 auth behavior",
5
5
  "license": "MIT",
6
6
  "type": "commonjs",