Repository navigation
v0.6.0 — OptionSet identity in read tools
Changed
- BREAKING —
get_picklist_optionsno longer returns a bare[{ value, label }]array. It now returns{ option_set: { name, is_global, metadata_id }, options: [{ value, label }] }(closes #61). The flat array made a Local OptionSet and a Global one indistinguishable: the response shape was identical either way, and matching values do not prove a binding. Callers that consumed the array directly need to read.options. get_picklist_optionsnow resolves Choice, Status, State and MultiSelect columns, not just Choice.statecode/statuscodepreviously failed with "Picklist attribute not found"; the not-found message now names the whole choice family.
Added
get_entity_schemaattaches anoption_setsummary —{ name, is_global, metadata_id, option_count }— to every choice-style column, so a schema dump answers "what can this column contain, and is the list shared?" without a call per column. The option values themselves are deliberately excluded; read them per column withget_picklist_options.
Failure behavior
Reading OptionSet data turns get_entity_schema from one metadata request into five, so the two tools handle a failing request differently — in both cases so that an unknown answer is never presented as a definite one:
get_entity_schemadegrades. The base attribute list is the tool's contract and does not depend on OptionSets, so a failing lookup no longer costs the caller the column list. The partial coverage is reported in a second content block (the JSON stays in the first), because a silently missingoption_setwould read as "this column has no options". A failure of the base request itself still fails the call.get_picklist_optionsfails hard. There, an empty result means "not a choice column", so swallowing an error would turn a transient failure into a confidentChoice attribute not foundon a column that does exist. For the same reason a matched column whoseOptionSetdid not come back is an error rather than a default ofis_global: false.
Notes
Verified live against a real org: a column bound to a global set reports is_global: true with the global set's own metadata_id, while a locally-defined column reports is_global: false with an auto-generated name.
Two Web API details found during that verification, both encoded in src/tools/optionset-utils.ts:
OptionSetis only reachable through a type cast, and the cast must name a concrete type. Casting to the abstract base —/Attributes/Microsoft.Dynamics.CRM.EnumAttributeMetadata— is rejected with HTTP 5000x8006088a: Unexpected attribute type, despite the docs listing it as a GET-able entity type. Each concrete choice type is therefore requested separately.- The sibling
GlobalOptionSetnavigation property is not a usable binding signal: for a locally-defined column it resolves to that column's own local set rather than returning null, so it cannot tell the two cases apart.IsGlobalon the expandedOptionSetis the reliable indicator.