1

GOAL/OBJECTIVE: Add a dependent picklist (Loss_Reason__c) to the StandardValueSet : OpportunityStage, using SFDX as the package deployment method (rather than ANT Migration Tool).

The fields (Loss_Reason__c and OpportunityStage) already exist in production, but they have no field dependency association between them. I can certainly add that dependency in Production, but I want to instead utilize DX as a method for making such changes.

I've enabled DevHub on my produciton org, created a scratch org, and a package.xml that retreives these two fields down from production.

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

I've created a scratch org and pushed these two fields into it. I then logged into the sracth org, created the field dependency manually via Setup. I saved the changes in the scratch org, and then from VS Code typed:

sfdx force:source:status === Source Status No results found

It appears that the changes I've created (adding a field dependency between two existing fields) is not being recognized.

I see that Paul Taylor ran into this issue here: SFDX source pull field dependencies, and his solution was to make a change to the object itself.

I could do that easily for a custom object (adding a description), but how to make a change to a Standard Object (Opportunity)?

1 Answer 1

1

One alternate approach, for situations like this one where Source Tracking is missing subtle changes you've enacted in the org, is to ask SFDX explicitly to retrieve the involved entity rather than relying on Source Tracking.

You can do that with the sfdx force:source:retrieve command, which takes a -m parameter with a specification of what metadata you'd like to pull. It does retrieve in source format.

Here, it looks like what you'd want is simply to do sfdx force:source:retrieve -m CustomObject:Opportunity.

You must log in to answer this question.

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