Skip to content

[21144] feat(servicenow): Add new actions across service-catalog, knowledge-base#21190

Merged
mariano-pd merged 15 commits into
masterfrom
issue-21144-servicenow
Jun 26, 2026
Merged

[21144] feat(servicenow): Add new actions across service-catalog, knowledge-base#21190
mariano-pd merged 15 commits into
masterfrom
issue-21144-servicenow

Conversation

@ashwins01

@ashwins01 ashwins01 commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

Summary

Resolves #21144
Adds actions across Service Catalog, Knowledge Base, and user-lookup.

Checklist

Please check the following items before your PR can be reviewed:

Versioning

  • All components updated in this PR had their version updated (0.0.1 for new ones)
  • The app updated in this PR had its package.json's version updated

New app

If this is a new app, please submit an app integration request - the PR will only be reviewed after the app is integrated.

  • The app updated in this PR is already integrated

CodeRabbit review

After the PR is opened, and if new changes are pushed, CodeRabbit will automatically review it. Do not 'mark as resolved' CodeRabbit's comments, but reply to them instead, whether you agree (and update the PR accordingly) or disagree.

  • I have addressed or acknowledged all of CodeRabbit's review comments

Summary by CodeRabbit

  • New Features
    • Added new ServiceNow actions for adding items to cart, viewing/emptying carts, deleting cart items, checking order status, ordering catalog items directly, submitting cart orders, and submitting record producers.
    • Added actions to fetch catalog item variables, search catalog items, search knowledge articles, and find users.
    • Expanded ServiceNow workflow support for catalog, cart, requests, users, and knowledge.
  • Updates
    • Improved result normalization and user-facing success summaries.
    • Bumped action versions and enhanced ServiceNow integration options (including new limit/quantity/variables/requested-for controls).
    • Added safer query input validation for search fields.

@pipedream-component-development

Copy link
Copy Markdown
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
Copy Markdown
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:

@vercel

vercel Bot commented Jun 17, 2026

Copy link
Copy Markdown

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

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
pipedream-docs-redirect-do-not-edit Ignored Ignored Jun 25, 2026 7:52am

Request Review

@coderabbitai

coderabbitai Bot commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Adds new ServiceNow actions for catalog ordering, cart management, knowledge search, user lookup, and order status. The app gains shared constants, new prop definitions, and request wrappers. Eight existing action versions and the package version are also updated.

Changes

ServiceNow Action Expansion

Layer / File(s) Summary
Shared constants, validation, and app methods
components/servicenow/common/constants.mjs, components/servicenow/common/utils.mjs, components/servicenow/servicenow.app.mjs, components/servicenow/package.json
Adds ServiceNow base-path and table constants, a query-safety validator, expanded app prop definitions, an instance base URL helper, Service Catalog and Knowledge Base request wrappers, table-backed user and request helpers, and a package version bump.
Catalog discovery and ordering actions
components/servicenow/actions/search-catalog-items/..., components/servicenow/actions/get-catalog-item-variables/..., components/servicenow/actions/add-item-to-cart/..., components/servicenow/actions/order-catalog-item/..., components/servicenow/actions/submit-record-producer/...
Adds catalog search, item variable lookup, add-to-cart, direct order, and record-producer actions that map props to ServiceNow requests and export summaries from returned identifiers.
Cart lifecycle actions
components/servicenow/actions/checkout-cart/..., components/servicenow/actions/submit-cart-order/..., components/servicenow/actions/view-cart/..., components/servicenow/actions/empty-cart/..., components/servicenow/actions/delete-cart-item/...
Adds checkout, submit-order, view-cart, empty-cart, and delete-cart-item actions that call the corresponding app methods and derive summaries from request identifiers or cart item counts.
Knowledge, user, and order lookup actions
components/servicenow/actions/search-knowledge-base/..., components/servicenow/actions/find-users/..., components/servicenow/actions/check-order-status/...
Adds knowledge-base search, user lookup, and order-status actions that validate query values, build ServiceNow query strings, normalize array responses for counts, and derive summaries from matched records.
Action version bumps
components/servicenow/actions/create-table-record/..., components/servicenow/actions/delete-table-record/..., components/servicenow/actions/get-record-counts-by-field/..., components/servicenow/actions/get-table-record-by-id/..., components/servicenow/actions/get-table-records/..., components/servicenow/actions/list-tables/..., components/servicenow/actions/search-records-by-keyword/..., components/servicenow/actions/update-table-record/...
Updates version metadata on eight existing action modules without changing runtime logic.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Suggested reviewers

  • GTFalcao
  • mariano-pd
🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Linked Issues check ⚠️ Warning Issue #21144 is only partially met: catalog, KB, user lookup, and cart actions exist, but named-cart checkout and explicit decline/cancel flow aren't shown. Add actions for named-cart checkout and decline/cancel behavior, or document the existing action that fulfills each missing requirement.
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title is concise and matches the main change: adding new ServiceNow actions for service-catalog and knowledge-base workflows.
Description check ✅ Passed The description follows the template with summary and checklist sections, and the required versioning/review boxes are filled out.
Out of Scope Changes check ✅ Passed The extra files are all related to the new ServiceNow toolset, shared helpers, or version bumps, with no unrelated feature area changes.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch issue-21144-servicenow

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@components/servicenow/actions/approve-cart/approve-cart.mjs`:
- Around line 17-24: The approvalSysId prop is currently defined inline in the
approve-cart.mjs component props object and is duplicated in decline-cart.mjs,
violating the centralization guideline for shared props. Move the approvalSysId
property definition (with its type, label, and description) to the servicenow
app's propDefinitions in the app file, then replace the inline definition in
approve-cart.mjs props with a reference using propDefinition that points to the
centralized definition. Apply the same change to decline-cart.mjs to remove the
duplicate inline definition.

In `@components/servicenow/actions/delete-cart-item/delete-cart-item.mjs`:
- Around line 16-20: The description property of the cartItemId object lacks a
concrete example value that is required for agent-facing ID props. Update the
description string in the cartItemId field to include an inline example of what
a cart item ID looks like, such as appending "such as
`0f3b2e2e1b223010d3f5a6c1cd4bcb12`" to the existing description text, to help AI
agents understand the expected format and value structure.

In `@components/servicenow/servicenow.app.mjs`:
- Around line 122-129: In the `propDefinitions` object of the servicenow.app.mjs
file, add definitions for the props catalogItemSysId, quantity, variables, and
requestedFor that are currently repeated inline across multiple actions. Define
each prop once in propDefinitions with consistent AI-oriented descriptions and
examples (following the same pattern as the existing limit prop definition).
Then in each action where these props are currently defined inline, replace
those inline definitions with references using propDefinition to reference the
centralized definitions from the app-level propDefinitions.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 27fe9f47-8143-42a4-84b9-74d5d7e83107

📥 Commits

Reviewing files that changed from the base of the PR and between 0d06825 and ed1238d.

📒 Files selected for processing (27)
  • components/servicenow/actions/add-item-to-cart/add-item-to-cart.mjs
  • components/servicenow/actions/approve-cart/approve-cart.mjs
  • components/servicenow/actions/check-order-status/check-order-status.mjs
  • components/servicenow/actions/checkout-cart/checkout-cart.mjs
  • components/servicenow/actions/create-table-record/create-table-record.mjs
  • components/servicenow/actions/custom-checkout-cart/custom-checkout-cart.mjs
  • components/servicenow/actions/decline-cart/decline-cart.mjs
  • components/servicenow/actions/delete-cart-item/delete-cart-item.mjs
  • components/servicenow/actions/delete-table-record/delete-table-record.mjs
  • components/servicenow/actions/get-catalog-item-variables/get-catalog-item-variables.mjs
  • components/servicenow/actions/get-current-user/get-current-user.mjs
  • components/servicenow/actions/get-record-counts-by-field/get-record-counts-by-field.mjs
  • components/servicenow/actions/get-table-record-by-id/get-table-record-by-id.mjs
  • components/servicenow/actions/get-table-records/get-table-records.mjs
  • components/servicenow/actions/get-user-by-email/get-user-by-email.mjs
  • components/servicenow/actions/list-tables/list-tables.mjs
  • components/servicenow/actions/lookup-user-by-name/lookup-user-by-name.mjs
  • components/servicenow/actions/order-catalog-item/order-catalog-item.mjs
  • components/servicenow/actions/search-catalog-items/search-catalog-items.mjs
  • components/servicenow/actions/search-knowledge-base/search-knowledge-base.mjs
  • components/servicenow/actions/search-records-by-keyword/search-records-by-keyword.mjs
  • components/servicenow/actions/submit-record-producer/submit-record-producer.mjs
  • components/servicenow/actions/update-table-record/update-table-record.mjs
  • components/servicenow/actions/view-cart/view-cart.mjs
  • components/servicenow/common/constants.mjs
  • components/servicenow/package.json
  • components/servicenow/servicenow.app.mjs

Comment thread components/servicenow/actions/approve-cart/approve-cart.mjs Outdated
Comment thread components/servicenow/actions/delete-cart-item/delete-cart-item.mjs
Comment thread components/servicenow/servicenow.app.mjs

export default {
key: "servicenow-approve-cart",
name: "Approve Cart",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

As per the request

• approve_servicenow_cart — Approve the bundle: checks out the cart and creates the REQ • decline_servicenow_cart — Decline the bundle: empties and cancels the entire cart

The component should checkout and create req for approve and for decline it should cancel / empty entire cart.

I can see that already checkout and decline cart is already available. Check the use case of the component.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

checkout + create REQ is already covered by checkout-cart action, so removed the redundant approve-cart.
changed decline-cart to empty-cart.


export default {
key: "servicenow-decline-cart",
name: "Decline Cart",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

As per the request

approve_servicenow_cart — Approve the bundle: checks out the cart and creates the REQ • decline_servicenow_cart — Decline the bundle: empties and cancels the entire cart

The component should checkout and create req for approve and for decline it should cancel / empty entire cart.

I can see that already checkout and decline cart is already available. Check the use case of the component.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

changed decline-cart to empty-cart.

},
});

const request = response[0];

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Throw a ConfigurationError when response is empty:

if (!response?.length) {
throw new ConfigurationError(No request found with number "${this.requestNumber}");
}

or in the summary : No request found with number ${this.requestNumber}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

added a new summary export for request not found usecase

categorySysId: {
type: "string",
label: "Category Sys ID",
description: "Optional category `sys_id` to restrict results to a single category (maps to `sysparm_category`).",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Add example of category sys id and also way to fetch the category id from other action component.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

example sys_id added plus a pointer to Get Table Records on the sc_category table.

export default {
key: "servicenow-search-knowledge-base",
name: "Search Knowledge Base",
description: "Search ServiceNow knowledge base articles via the Knowledge Management API (requires the `sn_km_api` plugin). Returns matching articles with snippets; retrieve a full article body by its id with **Get Table Records** on `kb_knowledge` or the article detail endpoint. [See the documentation](https://www.servicenow.com/docs/r/zurich/api-reference/rest-apis/c_KnowledgeManagementAPI.html)",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Link provided is incorrect, Kindly update the link with correct link

https://www.servicenow.com/docs/r/zurich/api-reference/rest-apis/knowledge-api.html and validate it.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

changed to https://www.servicenow.com/docs/r/zurich/api-reference/rest-apis/knowledge-api.html

approvalSysId: {
type: "string",
label: "Approval Sys ID",
description: "The `sys_id` of the `sysapproval_approver` record. Use **Get Table Records** on `sysapproval_approver` to find pending approvals.",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

In the description provide example of approvalSysId

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

removed the approvalSysId propDef was removed when approve/decline were reworked into Checkout Cart / Empty Cart, hence not needed.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@components/servicenow/actions/check-order-status/check-order-status.mjs`:
- Around line 30-40: The query building in checkOrderStatus is concatenating
requestNumber and requestedFor directly into sysparm_query, which can let
special characters alter the filter. Update the checkOrderStatus method to
validate or escape both values before pushing them into queryParts, and only
build the ServiceNow query from sanitized inputs with the expected format.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 74bf6b93-5944-4166-81f7-19511fc3db35

📥 Commits

Reviewing files that changed from the base of the PR and between 8c99050 and 0eed20c.

📒 Files selected for processing (9)
  • components/servicenow/actions/add-item-to-cart/add-item-to-cart.mjs
  • components/servicenow/actions/check-order-status/check-order-status.mjs
  • components/servicenow/actions/get-catalog-item-variables/get-catalog-item-variables.mjs
  • components/servicenow/actions/search-catalog-items/search-catalog-items.mjs
  • components/servicenow/actions/search-knowledge-base/search-knowledge-base.mjs
  • components/servicenow/actions/submit-cart-order/submit-cart-order.mjs
  • components/servicenow/actions/submit-record-producer/submit-record-producer.mjs
  • components/servicenow/actions/view-cart/view-cart.mjs
  • components/servicenow/servicenow.app.mjs

@vetrivigneshwaran

Copy link
Copy Markdown
Contributor

@ashwins01 - Component check is failing can you kindly run below command to update the version

sed -i '' 's/0.0.2/0.0.3/' components/servicenow/actions/get-current-user/get-current-user.mjs && sed -i '' 's/0.0.2/0.0.3/' components/servicenow/actions/get-current-user/get-current-user.mjs

@vetrivigneshwaran vetrivigneshwaran left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@mariano-pd mariano-pd left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

QA testing successful!

@mariano-pd mariano-pd merged commit c3e0265 into master Jun 26, 2026
9 checks passed
@mariano-pd mariano-pd deleted the issue-21144-servicenow branch June 26, 2026 19:52
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.

[ACTION] Need more tools for the ServiceNow MCP

4 participants