Conversation
PR SummaryMedium Risk Overview Wires these triggers into the app by registering them in Updates Reviewed by Cursor Bugbot for commit 85291dc. Configure here. |
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Greptile SummaryThis PR adds 5 ServiceNow webhook triggers ( The trigger config structure, barrel exports, block integration, and registry registration all follow established patterns correctly. However, there is a critical gap: unlike every other multi-event provider (Jira, GitHub, Notion, etc.), no
Key changes:
Confidence Score: 3/5Not safe to merge as-is — trigger type differentiation is fundamentally broken without a ServiceNow webhook provider handler The P1 issue (missing provider handler in lib/webhooks/providers/) means all 5 new trigger types behave identically at runtime. There is no event matching, so a workflow configured for 'Incident Created' will fire on 'Incident Updated' and 'Change Request Created' events too. The tableName filter also has no effect. These are the core features of the PR, and they don't work without the missing handler. A new file apps/sim/lib/webhooks/providers/servicenow.ts needs to be created and registered in apps/sim/lib/webhooks/providers/registry.ts with matchEvent, shouldSkipEvent, and formatInput implementations Important Files Changed
Sequence DiagramsequenceDiagram
participant SN as ServiceNow
participant WH as Webhook Handler
participant PH as Provider Registry
participant WF as Workflow Executor
SN->>WH: POST /api/webhooks/trigger/[path]
WH->>PH: getProviderHandler('servicenow')
Note over PH: ⚠️ No 'servicenow' entry<br/>Falls back to defaultHandler
PH-->>WH: defaultHandler (bearer token only)
Note over WH: matchEvent() → not implemented<br/>shouldSkipEvent() → not implemented<br/>formatInput() → not implemented
WH->>WF: Execute with raw body
Note over WF: ALL trigger types fire<br/>regardless of event type<br/>tableName filter ignored
|
| const instructions = [ | ||
| '<strong>Note:</strong> You need admin or developer permissions in your ServiceNow instance to create Business Rules.', | ||
| 'Navigate to <strong>System Definition > Business Rules</strong> and create a new Business Rule.', | ||
| `Set the table (e.g., <strong>incident</strong>, <strong>change_request</strong>), set <strong>When</strong> to <strong>after</strong>, and check <strong>${eventType}</strong>.`, | ||
| 'Check the <strong>Advanced</strong> checkbox to enable the script editor.', | ||
| `In the script, use <strong>RESTMessageV2</strong> to POST the record data as JSON to the <strong>Webhook URL</strong> above. Example:<br/><code style="font-size: 0.85em; display: block; margin-top: 4px; white-space: pre-wrap;">var r = new sn_ws.RESTMessageV2();\nr.setEndpoint("<webhook_url>");\nr.setHttpMethod("POST");\nr.setRequestHeader("Content-Type", "application/json");\nr.setRequestBody(JSON.stringify({\n sysId: current.sys_id + "",\n number: current.number + "",\n shortDescription: current.short_description + "",\n state: current.state + "",\n priority: current.priority + ""\n}));\nr.execute();</code>`, | ||
| 'Activate the Business Rule and click "Save" above to activate your trigger.', | ||
| ] | ||
|
|
||
| return instructions | ||
| .map( | ||
| (instruction, index) => | ||
| `<div class="mb-3">${index === 0 ? instruction : `<strong>${index}.</strong> ${instruction}`}</div>` | ||
| ) | ||
| .join('') | ||
| } |
There was a problem hiding this comment.
Example script sends fewer fields than declared outputs
The sample Business Rule script sends only 5 fields:
{ sysId, number, shortDescription, state, priority }But the trigger outputs (buildIncidentOutputs, buildChangeRequestOutputs, buildServiceNowWebhookOutputs) declare many additional handles users will see in the workflow editor — description, urgency, impact, category, subcategory, caller, assignedTo, assignmentGroup, createdBy, createdOn, updatedBy, updatedOn, resolvedBy, resolvedAt, closeNotes, tableName, eventType, and record.
Users who copy the example script verbatim will find all those extra output handles empty at runtime. Consider expanding the example to send all declared output fields, or adding a note that the example is minimal and users need to extend the script to populate the additional handles.
Summary
Type of Change
Testing
tested manually
Checklist