jneale / Xplore

Xplore: Developer Toolkit for ServiceNow
MIT License
197 stars 147 forks source link

Provide utility for quickly viewing a given field's choice values #47

Open chaorace opened 3 years ago

chaorace commented 3 years ago

Here's a common scenario: You're writing a script and need to check the value of a multiple choice field (e.g., a task's state). You don't remember the internal value for the choice option you're trying to check against, so you have to drop what you're doing, hunt down a record from the table, open up the field context menu, then select "Configure Choices". What a pain!

I want Xplore to have a side panel utility (similar to the Table Hierarchy panel) that lets you browse table fields and view their respective choice options.

I'm imagining inputs like this: Input Name Input Options Notes
Table All defined tables Omit tables without fields
Field All fields from the selected table Readonly until table selected, omit fields without choice options
With the output displayed beneath these inputs, which might look like this (using table incident and field state as inputs): Label Value
New 1
In Progress 2
On Hold 3
Resolved 6
Closed 7
Cancelled 8

NOTE: If a given table has no sys_choice records specified for a field, that may mean still mean the choices are defined on an ancestor table. You only need to take into account the choices defined for the first ancestor with sys_choice records, not all choices defined for all ancestors.

As an example, given this hierarchy of inheriting tables: table_a => table_b => table_c

Where table_a has these sys_choices for field pick_one: Foo (1), Bar (10)

Where table_b has these sys_choices for field pick_one: Foo (2), Baz (20)

Where table_c has no defined sys_choices for field pick_one

The following output would be expected when viewing choices for table table_c with field pick_one: Label Value
Foo 2
Baz 20
jneale commented 3 years ago

Nice suggestion. Thanks.