Skip to content

Commit 5beb971

Browse files
committed
fix(servicenow): give list-attachments limit a unique subBlock id
Read Records and List Attachments shared the subBlock id 'limit', so the single-value-per-id store could bleed the value across operations. Rename the new list-attachments field to attachmentLimit and map it back to the tool's limit param.
1 parent d651fce commit 5beb971

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

apps/sim/blocks/blocks/servicenow.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -314,9 +314,9 @@ Output: {"state": "2", "assigned_to": "john.doe", "work_notes": "Assigned and st
314314
required: true,
315315
description: 'sys_id of the record the attachment belongs to',
316316
},
317-
// List attachments: limit
317+
// List attachments: limit (unique id to avoid sharing the Read Records `limit` value)
318318
{
319-
id: 'limit',
319+
id: 'attachmentLimit',
320320
title: 'Limit',
321321
type: 'short-input',
322322
placeholder: '10',
@@ -385,10 +385,11 @@ Output: {"state": "2", "assigned_to": "john.doe", "work_notes": "Assigned and st
385385
config: {
386386
tool: (params) => params.operation,
387387
params: (params) => {
388-
const { operation, fields, file, ...rest } = params
388+
const { operation, fields, file, attachmentLimit, ...rest } = params
389389
const isCreateOrUpdate =
390390
operation === 'servicenow_create_record' || operation === 'servicenow_update_record'
391391

392+
if (attachmentLimit != null && attachmentLimit !== '') rest.limit = Number(attachmentLimit)
392393
if (rest.limit != null && rest.limit !== '') rest.limit = Number(rest.limit)
393394
if (rest.offset != null && rest.offset !== '') rest.offset = Number(rest.offset)
394395

@@ -423,6 +424,10 @@ Output: {"state": "2", "assigned_to": "john.doe", "work_notes": "Assigned and st
423424
number: { type: 'string', description: 'Record number' },
424425
query: { type: 'string', description: 'Query string' },
425426
limit: { type: 'number', description: 'Result limit' },
427+
attachmentLimit: {
428+
type: 'number',
429+
description: 'Max attachments to return (list attachments)',
430+
},
426431
offset: { type: 'number', description: 'Pagination offset' },
427432
fields: { type: 'json', description: 'Fields object or JSON string' },
428433
displayValue: { type: 'string', description: 'Display value mode for reference fields' },

0 commit comments

Comments
 (0)