Include inherited ServiceNow table fields in field lookup#2312
Include inherited ServiceNow table fields in field lookup#2312ravikiranvm wants to merge 9 commits into
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>
There was a problem hiding this comment.
Pull request overview
This PR updates the ServiceNow dictionary field lookup to include inherited fields by walking the sys_db_object table inheritance chain, so child tables (e.g. incident) surface parent fields in mapping dropdowns.
Changes:
- Add
sys_db_objectlookups to build a table hierarchy (child → parent → …). - Query
sys_dictionaryfor all tables in that hierarchy and merge/deduplicate fields byelement, preferring the most specific table. - Increase
sys_dictionaryfetch limit to accommodate the expanded query set.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| const tables = await getServiceNowTables(auth as ServiceNowAuth, { | ||
| query: 'nameSTARTSWITHx_', | ||
| }); | ||
| const tables = await getServiceNowTables(auth as ServiceNowAuth); |
There was a problem hiding this comment.
This reverts the change committed in https://github.com/openops-cloud/openops/pull/2259/changes#diff-46cca212ec4c6c22b05d80a485896ee77a3eae825266ba8f602e1d8e27248b8cL24. This fixes the tables dropdown issue and fixes OPS-4431
| try { | ||
| tableNames = await getServiceNowTableHierarchy(auth, tableName); | ||
| } catch (error) { | ||
| tableNames = [tableName]; |
There was a problem hiding this comment.
Marco is not sure yet of what table would we have permissions for.
So if the user doesn't have permission to the 'sys_db_object', we fall-back to the original approach.
| fieldName: Property.StaticDropdown<string>({ | ||
| displayName: 'Field name', | ||
| description: | ||
| 'Includes inherited fields from parent tables if your account has read access to sys_db_object.', |
There was a problem hiding this comment.
This is to let user know if he is confused about the missing fields.
|



Fixes OPS-4414 and OPS-4431
Problem
I was not able to see some service now table fields like
DescriptionandShort Description. It was due to that these fields were inherited from parent tables and we were looking for only the fields defined in the given table.ServiceNow doesn't have an endpoint to return all the table fields their UI shows. There is one undocumented endpoint that returns all table fields that are shown on ServiceNow UI
/ui/meta/{table}. But it is not officially available in their docs.The current PR approach is how people usually solve this problem. Look ServiceNow REST API: Get list of column names
Fix
sys_db_objecttable hierarchy (the table of all tables in SN) when loading dictionary fieldsincident) expose fields likedescription