[21144] feat(servicenow): Add new actions across service-catalog, knowledge-base#21190
Conversation
|
Thank you so much for submitting this! We've added it to our backlog to review, and our team has been notified. |
|
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:
|
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
|
Note Reviews pausedIt 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 Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughAdds 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. ChangesServiceNow Action Expansion
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Suggested reviewers
🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
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
📒 Files selected for processing (27)
components/servicenow/actions/add-item-to-cart/add-item-to-cart.mjscomponents/servicenow/actions/approve-cart/approve-cart.mjscomponents/servicenow/actions/check-order-status/check-order-status.mjscomponents/servicenow/actions/checkout-cart/checkout-cart.mjscomponents/servicenow/actions/create-table-record/create-table-record.mjscomponents/servicenow/actions/custom-checkout-cart/custom-checkout-cart.mjscomponents/servicenow/actions/decline-cart/decline-cart.mjscomponents/servicenow/actions/delete-cart-item/delete-cart-item.mjscomponents/servicenow/actions/delete-table-record/delete-table-record.mjscomponents/servicenow/actions/get-catalog-item-variables/get-catalog-item-variables.mjscomponents/servicenow/actions/get-current-user/get-current-user.mjscomponents/servicenow/actions/get-record-counts-by-field/get-record-counts-by-field.mjscomponents/servicenow/actions/get-table-record-by-id/get-table-record-by-id.mjscomponents/servicenow/actions/get-table-records/get-table-records.mjscomponents/servicenow/actions/get-user-by-email/get-user-by-email.mjscomponents/servicenow/actions/list-tables/list-tables.mjscomponents/servicenow/actions/lookup-user-by-name/lookup-user-by-name.mjscomponents/servicenow/actions/order-catalog-item/order-catalog-item.mjscomponents/servicenow/actions/search-catalog-items/search-catalog-items.mjscomponents/servicenow/actions/search-knowledge-base/search-knowledge-base.mjscomponents/servicenow/actions/search-records-by-keyword/search-records-by-keyword.mjscomponents/servicenow/actions/submit-record-producer/submit-record-producer.mjscomponents/servicenow/actions/update-table-record/update-table-record.mjscomponents/servicenow/actions/view-cart/view-cart.mjscomponents/servicenow/common/constants.mjscomponents/servicenow/package.jsoncomponents/servicenow/servicenow.app.mjs
|
|
||
| export default { | ||
| key: "servicenow-approve-cart", | ||
| name: "Approve Cart", |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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", |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
changed decline-cart to empty-cart.
| }, | ||
| }); | ||
|
|
||
| const request = response[0]; |
There was a problem hiding this comment.
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}
There was a problem hiding this comment.
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`).", |
There was a problem hiding this comment.
Add example of category sys id and also way to fetch the category id from other action component.
There was a problem hiding this comment.
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)", |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.", |
There was a problem hiding this comment.
In the description provide example of approvalSysId
There was a problem hiding this comment.
removed the approvalSysId propDef was removed when approve/decline were reworked into Checkout Cart / Empty Cart, hence not needed.
There was a problem hiding this comment.
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
📒 Files selected for processing (9)
components/servicenow/actions/add-item-to-cart/add-item-to-cart.mjscomponents/servicenow/actions/check-order-status/check-order-status.mjscomponents/servicenow/actions/get-catalog-item-variables/get-catalog-item-variables.mjscomponents/servicenow/actions/search-catalog-items/search-catalog-items.mjscomponents/servicenow/actions/search-knowledge-base/search-knowledge-base.mjscomponents/servicenow/actions/submit-cart-order/submit-cart-order.mjscomponents/servicenow/actions/submit-record-producer/submit-record-producer.mjscomponents/servicenow/actions/view-cart/view-cart.mjscomponents/servicenow/servicenow.app.mjs
|
@ashwins01 - Component check is failing can you kindly run below command to update the version
|
mariano-pd
left a comment
There was a problem hiding this comment.
QA testing successful!
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
0.0.1for new ones)package.json's version updatedNew app
If this is a new app, please submit an app integration request - the PR will only be reviewed after the app is 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.
Summary by CodeRabbit