Move ServiceNow choice values to shared and add state fields helper#2316
Merged
Conversation
Walk the sys_db_object hierarchy and merge sys_dictionary entries so child tables like incident expose parent table fields in dropdowns. Co-authored-by: Cursor <cursoragent@cursor.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR refactors ServiceNow helpers so they can be reused across packages by moving getServiceNowChoiceValues into @openops/common and adding a new getServiceNowStateFields helper to identify candidate “status” columns (including inherited fields).
Changes:
- Added
getServiceNowStateFieldshelper to return status-like fields from a ServiceNow table’s dictionary (including parent-table fields). - Moved/re-exposed
getServiceNowChoiceValuesfrom the ServiceNow block to@openops/common, updating downstream imports/mocks. - Updated
@openops/commonexports to include the new/relocated ServiceNow helpers.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/openops/src/lib/servicenow/get-state-fields.ts | New helper to list status-like fields based on table dictionary metadata. |
| packages/openops/src/lib/servicenow/get-choice-values.ts | Adjusted auth import for the shared choice-values helper living in @openops/common. |
| packages/openops/src/index.ts | Re-exported the ServiceNow helpers from the @openops/common barrel. |
| packages/blocks/servicenow/src/lib/create-field-value-property.ts | Updated to consume getServiceNowChoiceValues from @openops/common. |
| packages/blocks/servicenow/test/lib/create-field-value-property.test.ts | Updated mocking strategy to mock getServiceNowChoiceValues from @openops/common. |
| packages/blocks/servicenow/test/lib/get-choice-values.test.ts | Removed block-level tests for getServiceNowChoiceValues (needs replacement in @openops/common). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Move getServiceNowChoiceValues / ServiceNowChoice from the ServiceNow block into @openops/common so it can be reused across packages. The blocks-level file is removed and its single consumer (create-field-value-property) now imports from @openops/common. - Add getServiceNowStateFields, a helper that returns the columns on a given table (including parent-table columns) that are usable as a status field (choice or integer with a layered sys_choice list). This is needed by upcoming campaign features that let users pick which ServiceNow field to read ticket state from. Stacked on top of #2312 because getServiceNowStateFields depends on the parent-hierarchy walk added there. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
ravikiranvm
commented
Jun 1, 2026
| * `choice` flag is `'1'` (dropdown) or `'3'` (dropdown without --None--). | ||
| * `'2'` (suggestion) is excluded because it allows free-text values. | ||
| */ | ||
| export async function getServiceNowStateFields( |
Contributor
Author
MarceloRGonc
approved these changes
Jun 1, 2026
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.




Moves
getServiceNowChoiceValuesfrom the ServiceNow block into@openops/commonso it can be reused across packages, and addsgetServiceNowStateFieldsa helper that returns the columns on a given table (including parent-table columns) usable as a status field.Part of OPS-4424