Skip to content

Fix picklist entry tasks failing on CLI-provided entries JSON - #4016

Open
jeromeyyy wants to merge 5 commits into
SFDO-Tooling:mainfrom
jeromeyyy:fix/cli-json-entries
Open

jeromeyyy wants to merge 5 commits into
SFDO-Tooling:mainfrom
jeromeyyy:fix/cli-json-entries

Conversation

@jeromeyyy

Copy link
Copy Markdown

Fixes #3953.

When entries is passed through the CLI, e.g.

cci task run add_picklist_entries -o picklists Account.Status__c -o entries '[{"fullName": "TestValue", "label": "Test Value"}]'

the option arrives as a JSON string, while AddPicklistEntries expects a list of dicts. The fullName check then iterates over the string's characters and always raises The 'fullName' key is required on all picklist values., exactly as reported in #3953. The sibling task add_standard_value_set_entries (AddValueSetEntries) has the same gap: it consumes entries without any parsing, so a CLI-provided JSON string fails there too.

Change

  • New process_list_of_dicts_arg helper in cumulusci/core/utils.py, next to process_list_arg / process_bool_arg: returns an existing list of dicts unchanged, parses a JSON string, and raises TaskOptionsError for invalid JSON or a value that is not a list of objects.
  • AddPicklistEntries._init_options and AddValueSetEntries._init_options normalize entries through it before the existing validation, so cumulusci.yml usage (already a list of dicts) is unchanged.

Tests

New regression tests in test_picklists.py and test_value_sets.py cover entries given as a JSON string (parsed and validated) and invalid JSON (raises TaskOptionsError). The picklists test reproduces the exact error from #3953 against the original code; all four tests fail before the fix and pass after.

Full suite: 3283 passed, 5 failed - all 5 failures verified to pre-exist on a clean tree (4 OAuth client tests and test_bad_entry_point; they fail identically without this change and are unrelated to it).

Added a function to parse a list of dictionaries from a string or JSON input.
Added process_list_of_dicts_arg utility to handle entries.
Initialize options for entries using process_list_of_dicts_arg.
Added tests for handling entries as JSON strings and invalid JSON strings in AddPicklistEntries task.
@jeromeyyy
jeromeyyy requested a review from a team as a code owner November 3, 2026 17:18
@salesforce-cla

salesforce-cla Bot commented Nov 3, 2026

Copy link
Copy Markdown

Thanks for the contribution! Before we can merge this, we need @jeromeyyy to sign the Salesforce Inc. Contributor License Agreement.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

add_picklist_entries never works through CLI

1 participant