7

I am using SFDX and creating scratch org to move my project metadata. But I'm facing challenge when with Standard picklist fields.

As I am moving record type and value reference in that so I am getting dependency error.

I can solve this by manually add those values in scratch org but is there any better solution available for similar problem.

2
  • 1
    Standard picklist values are stored in the StandardValueSet metadata type. Are you including that type in your metadata?
    – Derek F
    Commented Apr 18, 2018 at 12:32
  • @DerekF I'm unable to find it. I am following steps here Migrating Existing Projects to Salesforce DX
    – SF User
    Commented Apr 18, 2018 at 12:57

2 Answers 2

13

Like I said in my comment, Standard picklist values are stored in the StandardValueSet metadata type.

Ensuring that you include standard picklist fields in your unmanaged package might give you the standard values as well, but I'm not 100% sure on that.

The sure-fire way that I know of is to create your own package.xml file, include that metadata type in it, and retrieve using that package.xml file via

sfdx force:mdapi:retrieve -k <relative path to your package.xml> -r <relative path to your target directory> -u <username or alias of org to retrieve from>

StandardValueSet is not one of the metadata types that supports wildcard, so you'd need to explicitly state which ones you want to pull. There is documentation that covers what the standard picklist fields are, and what valueSet name to use.

The one caveat that I've run into thus far is with ContractStatus. For some reason, this one picklist's values contains extra information that is not captured in the StandardValueSet metadata type. I have not found a way to deploy customizations to this field.

+edit:
Some clarification for those who may not have used the old force.com migration tool + Apache Ant.

package.xml is a file that looks like this:

<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
    <types>
        <members>*</members>
        <name>ApexClasses</name>
    </types>
    <version>52.0</version>
</Package>

Each metadata type that you specify is a <types> node.
For most of the metadata types, we can use the wildcard to say "just give me everything of this metadata type" (that's the <members>*</members> bit).
"StandardValueSet" cannot use the wildcard, so each standard picklist value set that you want needs to be explicitly named

<types>
    <members>AccountContactMultiRoles</members>
    <members>AccountContactRole</members>
    <members>AccountOwnership</members>
    <members>AccountRating</members>
    <members>AccountType</members>
    <members>AssetStatus</members>
    <!-- and so on... -->
    <name>StandardValueSet</name>
</types>
8
  • Ok let me try this.
    – SF User
    Commented Apr 18, 2018 at 13:25
  • @SFUser also, don't forget to convert to source form. You might want to convert into a separate directory (not sure if converting wipes out existing things in your project).
    – Derek F
    Commented Apr 18, 2018 at 13:31
  • so just for confirmation I will create unmanaged package and convert that into SFDX and then in package.xml file I will add the standard value set and will use this to deploy.
    – SF User
    Commented Apr 18, 2018 at 13:33
  • 1
    @SFUser not quite. I'd recommend just sticking to either the unmanaged package, or package.xml. If you need to use both, then retrieve your unmanaged package into one directory, convert to source form, then retrieve using your package.xml into a different directory, and convert that to source form (use the -d argument to specify a different folder for this conversion to prevent potential overwriting of your conversion of your unmanaged package).
    – Derek F
    Commented Apr 18, 2018 at 13:55
  • 4
    @PetrusRepo: sfdx force:source:retrieve -m StandardValueSet:CaseType Commented May 7, 2019 at 15:31
2

I put together all the standard value sets in metadata format for your package.xml files. Now you can use this to pull and push standard value sets:

<Package xmlns="http://soap.sforce.com/2006/04/metadata">
  <types>
    <members>AccountContactMultiRoles</members>
    <members>AccountContactRole</members>
    <members>AccountOwnership</members>
    <members>AccountRating</members>
    <members>AccountType</members>
    <members>AssetStatus</members>
    <members>CampaignMemberStatus</members>
    <members>CampaignStatus</members>
    <members>CampaignType</members>
    <members>CareItemStatus2</members>
    <members>CaseContactRole</members>
    <members>CaseOrigin</members>
    <members>CasePriority</members>
    <members>CaseReason</members>
    <members>CaseStatus</members>
    <members>CaseType</members>
    <members>ContactRole</members>
    <members>ContractContactRole</members>
    <members>ContractStatus</members>
    <members>EntitlementType</members>
    <members>EventSubject</members>
    <members>EventType</members>
    <members>FiscalYearPeriodName</members>
    <members>FiscalYearPeriodPrefix</members>
    <members>FiscalYearQuarterName</members>
    <members>FiscalYearQuarterPrefix</members>
    <members>FulfillmentStatus</members>
    <members>FulfillmentType</members>
    <members>IdeaCategory1</members>
    <members>IdeaMultiCategory</members>
    <members>IdeaStatus</members>
    <members>IdeaThemeStatus</members>
    <members>Industry</members>
    <members>LeadSource</members><members>LeadStatus</members>
    <members>OpportunityCompetitor</members>
    <members>OpportunityStage</members>
    <members>OpportunityType</members>
    <members>OrderItemSummaryChgRsn</members>
    <members>OrderStatus</members>
    <members>OrderSummaryRoutingSchdRsn</members>
    <members>OrderSummaryStatus</members>
    <members>OrderType</members>
    <members>PartnerRole</members>
    <members>Product2Family</members>
    <members>ProcessExceptionCategory</members>
    <members>ProcessExceptionPriority</members>
    <members>ProcessExceptionSeverity</members>
    <members>ProcessExceptionStatus</members>
    <members>QuestionOrigin1</members>
    <members>QuickTextCategory</members>
    <members>QuickTextChannel</members>
    <members>QuoteStatus</members>
    <members>RoleInTerritory2</members>
    <members>ResourceAbsenceType</members>
    <members>ReturnOrderLineItemProcessPlan</members>
    <members>ReturnOrderLineItemReasonForRejection</members>
    <members>ReturnOrderLineItemReasonForReturn</members>
    <members>ReturnOrderLineItemRepaymentMethod</members>
    <members>ReturnOrderShipmentType</members>
    <members>ReturnOrderStatus</members>
    <members>SalesTeamRole</members>
    <members>ServiceAppointmentStatus</members>
    <members>ServiceContractApprovalStatus</members>
    <members>ServTerrMemRoleType</members>
    <members>SocialPostClassification</members>
    <members>SocialPostEngagementLevel</members>
    <members>SocialPostReviewedStatus</members>
    <members>SolutionStatus</members>
    <members>TaskPriority</members>
    <members>TaskStatus</members>
    <members>TaskSubject</members>
    <members>TaskType</members>
    <members>WorkOrderLineItemStatus</members>
    <members>WorkOrderPriority</members>
    <members>WorkOrderStatus</members>
    <members>WorkTypeDefApptType</members>
    <members>WorkTypeGroupAddInfo</members>
    <name>StandardValueSet</name>
  </types>
  <version>52.0</version>
</Package>

You must log in to answer this question.

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