Skip to content

Conversation

ssk42
Copy link
Contributor

@ssk42 ssk42 commented Jun 20, 2025

Summary

  • Improved debug output during picklist field creation to be more user-friendly
  • Replaced unclear raw Go map output with clear, descriptive messages
  • Enhanced user experience when creating picklist fields
  • Updated picklist field creation to use Value Sets instead of deprecated picklist element for API v37.0+ compliance

Issue

Fixes #324

Problem Description

When creating picklist fields, the debug output was confusing and showed raw Go data structures:

$ ./force field create Airplanes__c "Final Outcome":picklist picklist:"Pass, Fail, Redo"
Options:  map[picklist>picklistValues:Pass, Fail, Redo]
Key picklist>picklistValues
Custom field created

Users found this output "not very clear" as it exposed internal implementation details.

Additionally, the picklist field creation was using the deprecated <picklist> element which was deprecated in API version 37.0.

Solution

Debug Messages:
Replaced the unclear debug messages with user-friendly output:

Before:

Options:  map[picklist>picklistValues:Pass, Fail, Redo]
Key picklist>picklistValues

After:

Creating picklist with values: Pass, Fail, Redo

Value Sets:
Updated XML generation to use modern Value Set structure instead of deprecated picklist element:

Before (deprecated):

<picklist>
<picklistValues>
<fullName>Pass</fullName>
<default>false</default>
</picklistValues>
</picklist>

After (modern):

<valueSet>
<valueSetDefinition>
<sorted>false</sorted>
<value>
<fullName>Pass</fullName>
<default>false</default>
<label>Pass</label>
</value>
</valueSetDefinition>
</valueSet>

Changes Made

  • lib/metadata.go:
    • Updated picklist creation debug output in CreateCustomField() method
    • Replaced deprecated <picklist> XML structure with modern <valueSet> approach
    • Added proper <label> elements for each picklist value
  • Removed raw map output and verbose key logging
  • Added clear, descriptive message showing what values are being configured

Test Plan

  • Code compiles successfully
  • All existing tests pass
  • No functional changes to picklist creation logic
  • Debug output is improved and user-friendly
  • Generated XML follows Metadata API v37.0+ standards
  • Value Set structure is correctly generated

🤖 Generated with Claude Code

The debug messages during picklist field creation were unclear and showed
raw Go map output which was confusing for users:

Before:
Options:  map[picklist>picklistValues:Pass, Fail, Redo]
Key picklist>picklistValues

After:
Creating picklist with values: Pass, Fail, Redo

The new output is more user-friendly and clearly communicates what
values are being set for the picklist field.

Fixes ForceCLI#324

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
@cwarden
Copy link
Member

cwarden commented Jun 20, 2025

The picklist element on Custom Fields was deprecated in API version 37.0. force field create is long overdue for an update to use Value Sets.

@ssk42
Copy link
Contributor Author

ssk42 commented Jun 20, 2025

Happy to tackle that! My apologies. Definitely should have realized that when I submitted the code

@cwarden
Copy link
Member

cwarden commented Jun 20, 2025

Happy to tackle that! My apologies. Definitely should have realized that when I submitted the code

Thanks for contributing. It's great to tackle some of these old issues.

ssk42 and others added 2 commits June 20, 2025 08:57
…d picklist element

Replace deprecated <picklist> XML structure with modern <valueSet> approach for API v37.0+ compliance.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
Remove trailing newline from <type>Picklist</type> to match other field types formatting.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

looks like incorect debug messages during creation of picklist
2 participants