1

As a user, I would like to add the following picklist values for Opportunity Type.

  • Value 1 - New Business
  • Value 2 - Expansion
  • Value 3 - Renewal

Is there a way to define this in the package.xml so that it can be present once it gets deployed to a customer org?

2
  • Is this in a managed package context or a deployment of unmanaged metadata into your customer's org?
    – Mark Pond
    Commented Jan 19, 2023 at 19:40
  • In this context it would be to add to what I already have in my XML file for development of my Unlocked package.
    – andrew
    Commented Jan 19, 2023 at 19:57

2 Answers 2

3

Standard Value Sets are not packageable in managed or unlocked packages. See the Metadata Coverage Report for details.

While you can store and deliver unpackaged metadata representing changes to the Standard Value Set, you must be very careful when doing so, as deploying that metadata has overwrite semantics. Any value set entries in the target org that are not in your deployed metadata will be deactivated. It's very easy to let this metadata get out of sync, or simply forget this behavior, and cause damage to an org.

CumulusCI ships with a task called add_standard_value_set_entries that aims to solve this by retrieving the existing value set from the org, dynamically adding values to it, and redeploying the metadata. Disclosure: I am a Salesforce employee and on the CumulusCI team.

2
  • Thank you for adding this excellent info! Some additional details about the StandardValueSet Names and Standard Picklist Fields.
    – Mark Pond
    Commented Jan 19, 2023 at 23:41
  • Dude im not a developer but I can tell this seems really cool @DavidReed! Im going to share with my dev team. Thank you.
    – andrew
    Commented Jan 20, 2023 at 23:33
1

Managed

In a managed package, changes to standard picklists can’t be packaged and deployed to subscriber orgs. To change values in subscriber orgs, you must manually add or modify the values in the target subscriber org.

More details can be found here in Components Available in Managed Packages

Unmanaged

Picklist values from standard fields can be retrieved from and deployed to orgs just like any other metadata. This metadata won't be in the package.xml file itself, rather it will be in the Opportunity object's metadata file.

The package.xml to retrieve or deploy this one field, will look like this:

<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
    <types>
        <members>Opportunity.Type</members>
        <name>CustomField</name>
    </types>
    <version>57.0</version>
</Package>

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .