Skip to content

Conversation

verhovsky
Copy link
Contributor

@verhovsky verhovsky commented Oct 8, 2025

Closes #16112

Summary by CodeRabbit

  • New Features
    • Added ServiceNow actions to create Cases and Incidents from workflows, with success summaries on creation.
    • Expanded configuration for ticket creation: title, description, severity (including a "Planning" level for incidents), status, channel, contact/company links, work notes, and comments.
    • Added app helpers to build channels, notes, related parties, and to create trouble tickets reliably.
  • Chores
    • Bumped ServiceNow component to v0.7.0 and upgraded platform dependency.

Copy link

vercel bot commented Oct 8, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Preview Comments Updated (UTC)
pipedream-docs-redirect-do-not-edit Ignored Ignored Oct 9, 2025 11:20pm

@pipedream-component-development
Copy link
Collaborator

Thank you so much for submitting this! We've added it to our backlog to review, and our team has been notified.

@pipedream-component-development
Copy link
Collaborator

Thanks for submitting this PR! When we review PRs, we follow the Pipedream component guidelines. If you're not familiar, here's a quick checklist:

Copy link
Contributor

coderabbitai bot commented Oct 8, 2025

Walkthrough

Adds ServiceNow app helpers, shared severity constants, two new actions to create Case and Incident trouble tickets, and bumps the ServiceNow component package version and platform dependency.

Changes

Cohort / File(s) Summary
ServiceNow Actions
components/servicenow/actions/create-case/create-case.mjs, components/servicenow/actions/create-incident/create-incident.mjs
Add two action modules exporting default action objects that collect inputs, use app helpers to build channel/notes/related parties, call createTroubleTicket with ticketType "Case" or "Incident", export a success summary, and return the API response.
ServiceNow App & Helpers
components/servicenow/servicenow.app.mjs
Expands propDefinitions and adds methods: baseUrl, authHeaders, buildChannel, buildNotes, buildRelatedParties, and createTroubleTicket (constructs payload and POSTs to ServiceNow API using axios).
Shared Constants
components/servicenow/common/constants.mjs
Introduces and exports DEFAULT_SEVERITY_OPTIONS and INCIDENT_SEVERITY_OPTIONS arrays.
Package Metadata
components/servicenow/package.json
Bumps package version to 0.7.0 and updates dependency @pipedream/platform to ^3.1.0.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor User
  participant Action as Create Action (Case/Incident)
  participant App as ServiceNow App
  participant API as ServiceNow API

  User->>Action: Provide inputs (name, description, severity, ...)
  Action->>App: buildNotes(workNote, comment)
  Action->>App: buildRelatedParties({...})
  Action->>App: buildChannel(channelName)
  alt Creating ticket
    Action->>App: createTroubleTicket({ ticketType: "Case" | "Incident", ... })
    App->>App: baseUrl() & authHeaders()
    App->>API: POST /trouble_ticket (payload)
    API-->>App: 201 Created / Error
    App-->>Action: API response
    Action-->>User: Export summary + response
  end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

I thump my paws—new tickets hop,
Notes and channels neatly pop.
Case and incident, off they go,
Headers hum and payloads flow.
A rabbit cheers: deploy, then hop! 🐇✨

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Description Check ⚠️ Warning The pull request description only contains “Closes #16112” and does not follow the repository’s template, which requires a “## WHY” section to explain the motivation, problem being addressed, and context for the changes. Without this information, reviewers lack the necessary context to understand the intent and impact of the new ServiceNow actions. The description must adhere to the template to ensure clarity and completeness. Please update the pull request description to include the required “## WHY” section per the template, providing details on the rationale, objectives, and any relevant background for the implementation. Including this context will enable reviewers to assess the changes effectively and ensure alignment with project goals.
✅ Passed checks (2 passed)
Check name Status Explanation
Title Check ✅ Passed The title succinctly conveys the introduction of new ServiceNow actions for ticket creation, which aligns with the addition of create-case and create-incident modules. It clearly communicates that the update pertains to ServiceNow ticket creation functionality and helps reviewers and future maintainers quickly identify the purpose of the changeset.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@verhovsky verhovsky requested a review from GTFalcao October 8, 2025 23:35
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
components/servicenow/actions/create-incident/create-incident.mjs (1)

66-108: Consider consolidating channelName and contactMethod propDefinitions.

Both create-case and create-incident actions use similar concepts (channelName vs contactMethod) that map to the same API parameter. The propDefinitions in servicenow.app.mjs have nearly identical descriptions:

  • channelName: "The channel that the ticket was created through."
  • contactMethod: "Method of contact that the ticket was created through."

Consider using a single propDefinition (e.g., channelName) for both actions to reduce duplication and maintain consistency, unless there's a specific ServiceNow business reason to distinguish between them.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 905ac86 and 14b7c22.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (5)
  • components/servicenow/actions/create-case/create-case.mjs (1 hunks)
  • components/servicenow/actions/create-incident/create-incident.mjs (1 hunks)
  • components/servicenow/common/constants.mjs (1 hunks)
  • components/servicenow/package.json (2 hunks)
  • components/servicenow/servicenow.app.mjs (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (3)
components/servicenow/actions/create-case/create-case.mjs (2)
components/servicenow/actions/create-incident/create-incident.mjs (3)
  • notes (83-86)
  • relatedParties (88-91)
  • response (93-103)
components/servicenow/servicenow.app.mjs (1)
  • notes (117-117)
components/servicenow/actions/create-incident/create-incident.mjs (2)
components/servicenow/actions/create-case/create-case.mjs (3)
  • notes (83-86)
  • relatedParties (88-91)
  • response (93-103)
components/servicenow/servicenow.app.mjs (1)
  • notes (117-117)
components/servicenow/servicenow.app.mjs (3)
components/servicenow/common/constants.mjs (2)
  • DEFAULT_SEVERITY_OPTIONS (1-18)
  • INCIDENT_SEVERITY_OPTIONS (20-26)
components/servicenow/actions/create-case/create-case.mjs (1)
  • notes (83-86)
components/servicenow/actions/create-incident/create-incident.mjs (1)
  • notes (83-86)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: Lint Code Base
  • GitHub Check: Publish TypeScript components
  • GitHub Check: Verify TypeScript components
🔇 Additional comments (12)
components/servicenow/package.json (1)

3-3: LGTM!

The version bump to 0.7.0 and platform dependency update to ^3.1.0 appropriately reflect the addition of new actions and features in this PR.

Also applies to: 16-16

components/servicenow/common/constants.mjs (2)

1-18: LGTM!

The severity options are well-structured with clear labels and string values that align with typical API enum patterns.


20-31: LGTM!

The incident severity options appropriately extend the default options with an additional "Planning" level, and the export structure is clean.

components/servicenow/servicenow.app.mjs (4)

1-7: LGTM!

Clean imports and constant destructuring from the new constants module.


93-104: LGTM!

The authentication methods correctly construct the base URL and authorization headers using OAuth bearer token.


105-149: LGTM!

The helper methods properly handle empty/undefined inputs and return appropriate data structures for the ServiceNow API.


150-180: Confirm field mappings against the SD-WAN Trouble Ticket API spec
The POST endpoint /api/sn_ind_tsm_sdwan/ticket/troubleTicket correctly supports both Case and Incident; ensure the request-body fields (notes, relatedParties, channel, ticketType, etc.) align with the API’s supported fields.

components/servicenow/actions/create-case/create-case.mjs (3)

1-8: LGTM!

The component key follows the correct format app_name_slug-slugified-component-name as per Pipedream guidelines.


9-65: LGTM!

All prop definitions correctly reference the ServiceNow app's propDefinitions.


66-108: LGTM!

The action correctly builds notes and related parties, validates required fields, and calls the ServiceNow API with appropriate parameters for creating a case.

components/servicenow/actions/create-incident/create-incident.mjs (2)

1-8: LGTM!

The component key follows the correct format as per Pipedream guidelines.


9-65: LGTM!

All prop definitions correctly reference the ServiceNow app's propDefinitions, using incident-specific fields.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
components/servicenow/actions/create-case/create-case.mjs (1)

84-86: Consider marking description as required in propDefinition.

Instead of validating at runtime, mark the description prop as required in its propDefinition. This provides:

  • Earlier validation before the action runs
  • Clearer error messages to users
  • Better developer experience

Update the propDefinition in servicenow.app.mjs:

description: {
  type: "string",
  label: "Description",
  description: "Description of the case",
  optional: false, // or simply omit 'optional' as props are required by default
},

Then remove the runtime validation from this action.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 14b7c22 and f2be981.

📒 Files selected for processing (2)
  • components/servicenow/actions/create-case/create-case.mjs (1 hunks)
  • components/servicenow/actions/create-incident/create-incident.mjs (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • components/servicenow/actions/create-incident/create-incident.mjs
🧰 Additional context used
🧬 Code graph analysis (1)
components/servicenow/actions/create-case/create-case.mjs (2)
components/servicenow/actions/create-incident/create-incident.mjs (3)
  • notes (88-91)
  • relatedParties (93-96)
  • response (98-108)
components/servicenow/servicenow.app.mjs (1)
  • notes (117-117)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: Publish TypeScript components
  • GitHub Check: Verify TypeScript components
  • GitHub Check: pnpm publish
  • GitHub Check: Lint Code Base
🔇 Additional comments (3)
components/servicenow/actions/create-case/create-case.mjs (3)

1-13: LGTM! Metadata follows component guidelines.

The component key follows the required format, and all metadata fields are properly configured.


88-112: LGTM! Action logic follows established patterns.

The implementation correctly uses the servicenow app helper methods and follows the same structure as create-incident. The response handling and summary export are appropriate.


14-70: Props naming is appropriate and intentional. The property names differ because ServiceNow uses accountId, contactId, and channelName for cases and companyId, userId, and contactMethod for incidents—no changes needed.

@verhovsky verhovsky requested a review from GTFalcao October 9, 2025 21:57
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
components/servicenow/actions/create-incident/create-incident.mjs (1)

14-70: Consider alignment with Case action prop naming.

The props are correctly defined, but there's a naming inconsistency between actions:

  • Create Incident uses contactMethod (line 40-44)
  • Create Case uses channelName (in create-case.mjs)

Both map to contact_type in the API and serve the same purpose. Consider standardizing the prop name across both actions for consistency.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f2be981 and 4dd0cf1.

📒 Files selected for processing (3)
  • components/servicenow/actions/create-case/create-case.mjs (1 hunks)
  • components/servicenow/actions/create-incident/create-incident.mjs (1 hunks)
  • components/servicenow/servicenow.app.mjs (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (3)
components/servicenow/actions/create-case/create-case.mjs (2)
components/servicenow/actions/create-incident/create-incident.mjs (4)
  • channel (84-84)
  • notes (91-94)
  • relatedParties (86-89)
  • response (96-108)
components/servicenow/servicenow.app.mjs (1)
  • notes (117-117)
components/servicenow/servicenow.app.mjs (3)
components/servicenow/common/constants.mjs (2)
  • DEFAULT_SEVERITY_OPTIONS (1-18)
  • INCIDENT_SEVERITY_OPTIONS (20-26)
components/servicenow/actions/create-case/create-case.mjs (1)
  • notes (86-89)
components/servicenow/actions/create-incident/create-incident.mjs (1)
  • notes (91-94)
components/servicenow/actions/create-incident/create-incident.mjs (2)
components/servicenow/actions/create-case/create-case.mjs (4)
  • channel (84-84)
  • relatedParties (91-94)
  • notes (86-89)
  • response (96-108)
components/servicenow/servicenow.app.mjs (1)
  • notes (117-117)
🔇 Additional comments (14)
components/servicenow/actions/create-case/create-case.mjs (4)

1-13: LGTM!

The component metadata and imports are well-structured. The documentation link addresses the past review comment.


14-70: LGTM!

Props are correctly defined using propDefinitions from the ServiceNow app, maintaining consistency with the component pattern.


71-95: LGTM!

The destructuring and helper method calls are clean and consistent with the established pattern.


96-113: LGTM!

The API call structure correctly passes the data object to createTroubleTicket, which forwards it as the request payload. The summary message is clear and appropriate.

components/servicenow/actions/create-incident/create-incident.mjs (3)

1-13: LGTM!

The component metadata and imports follow the same pattern as the create-case action, maintaining consistency across the codebase.


71-95: LGTM!

The destructuring and helper method calls are correctly implemented. The use of companyId/userId for incidents (vs accountId/contactId for cases) aligns with ServiceNow's data model where incidents relate to companies and users, while cases relate to accounts and contacts.


96-113: LGTM!

The API call structure and response handling are correctly implemented, mirroring the create-case action with the appropriate ticket type.

components/servicenow/servicenow.app.mjs (7)

1-8: LGTM!

The imports and constant destructuring are correctly structured and align with the platform dependencies.


12-48: LGTM!

The propDefinitions are well-structured with appropriate types, labels, descriptions, and options. The distinction between case and incident severity options is correctly implemented.


49-54: LGTM!

The label/description mismatch from the past review comment has been addressed. The label "Contact Method" now correctly aligns with the description.


55-90: LGTM!

The propDefinitions correctly use backticks for field names like Sys_id, addressing the past review comment. All descriptions are clear and consistent.


92-112: LGTM!

The helper methods for URL construction, authentication headers, and channel building are correctly implemented with appropriate null handling.


113-149: LGTM!

Both helper methods correctly construct the ServiceNow API payload structures with appropriate filtering and null handling. The buildRelatedParties method correctly filters out entries without IDs before mapping.


150-160: LGTM!

The createTroubleTicket method correctly constructs and executes the API request. The past review comment acknowledged that having a single request method is acceptable for this app given it's the only endpoint being used.

Copy link
Collaborator

@GTFalcao GTFalcao left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@GTFalcao
Copy link
Collaborator

Note to @vunguyenhung : we couldn't get the ServiceNow setup working for these components. It seems additional app setup is needed which we couldn't really figure out, but decided to move on with these two actions since they are following the API specs.

@vunguyenhung
Copy link
Collaborator

Hey @GTFalcao, I can setup the ServiceNow dev instance on my side.

Please refer to 1PW, I put my working creds (client id, client secret, instance name) there.

@verhovsky
Copy link
Contributor Author

verhovsky commented Oct 10, 2025

@vunguyenhung you also need to add the Telecommunications Assurance Workflows application to create the tables this API uses (from the API docs). I couldn't figure out how to do it and at least on this support thread from 2019 it says it's not possible to install apps in a dev instance.

Also, if someone tries to use your (client id, client secret, instance name) on Pipedream, it opens a ServiceNow tab asking you to log in with the username and password, but when you put in the username and password of the account it doesn't accept it for some reason. You should see what I'm talking about if you do it in an incognito window or maybe if you clear your ServiceNow cookies.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ServiceNow

4 participants