Skip to content

Commit 4e852c5

Browse files
committed
fix(servicenow): allow string workflowState values (published/draft/review/retired)
1 parent 80337c4 commit 4e852c5

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

apps/sim/connectors/servicenow/servicenow.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ const PAGE_SIZE = 100
2323
const SYS_ID_PATTERN = /^[a-f0-9]{32}$/i
2424
const NUMERIC_ID_PATTERN = /^\d+$/
2525
const KB_CATEGORY_PATTERN = /^[\w \-./]+$/
26+
const VALID_WORKFLOW_STATES = new Set(['published', 'draft', 'review', 'retired'])
2627

2728
interface ServiceNowRecord {
2829
sys_id: string
@@ -365,10 +366,12 @@ function buildKBQuery(sourceConfig: Record<string, unknown>): string {
365366

366367
const workflowState = sourceConfig.workflowState as string | undefined
367368
if (workflowState && workflowState !== 'all') {
368-
if (NUMERIC_ID_PATTERN.test(workflowState)) {
369+
if (VALID_WORKFLOW_STATES.has(workflowState)) {
369370
parts.push(`workflow_state=${workflowState}`)
370371
} else {
371-
logger.warn('Skipping workflowState filter: value is not a numeric ID', { workflowState })
372+
logger.warn('Skipping workflowState filter: value is not in the allowed set', {
373+
workflowState,
374+
})
372375
}
373376
}
374377

0 commit comments

Comments
 (0)