+ Start a Discussion
Eleanor Matthewman 8Eleanor Matthewman 8 

Using sfdx to deploy using a package.xml deploys more than just the package.xml components

Hi all,

We are trying to deploy selective components using SFDX (force:source:deploy -x package.xml). The package.xml only contains about 50 components, but it is trying to deploy 300 components (there are more than 300 components in the force-app folder, so it's not trying to deploy everything). There are three errors occuring on components not in the package.xml. Anyone undetstand why it is trying to deploy more than we have stated?

Thanks in advance.
Nikhil SutharNikhil Suthar
Hi Eleanor,
Can you show me your package.xml file please
Eleanor Matthewman 8Eleanor Matthewman 8
Sure, here it is:
<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
    <types>
        <members>Opportunity.EuroFinanceBudget__c</members>
        <members>Opportunity.EuroFinanceSubtotal__c</members>
        <members>Opportunity.EuroFinance_Split__c</members>
        <members>Opportunity.Max_EuroFinance_Discount__c</members>
        <members>Opportunity.Max_Signal_Noise_Discount__c</members>
        <members>Opportunity.Max_TVC_Discount__c</members>
        <members>Opportunity.Opportunity_Type__c</members>
        <members>Opportunity.OtherSubtotal__c</members>
        <members>Opportunity.Sales_Department__c</members>
        <members>Opportunity.SignalNoiseBudget__c</members>
        <members>Opportunity.SignalNoiseSubtotal__c</members>
        <members>Opportunity.Signal_Noise_Split__c</members>
        <members>Opportunity.TVCBudget__c</members>
        <members>Opportunity.TVCSubtotal__c</members>
        <members>Opportunity.TVC_Split__c</members>
        <members>Opportunity.Type</members>
        <members>OpportunityLineItem.Discount_IO__c</members>
        <members>OpportunityLineItem.Discount__c</members>
        <members>OpportunityLineItem.EMB_Discount__c</members>
        <members>OpportunityLineItem.ProductGroup__c</members>
        <members>Product2.Family</members>
        <members>Product2.Medium__c</members>
        <members>Product2.ProductGroup__c</members>
        <members>Sales_Agent__c.Sales_Department__c</members>
        <members>User.Business_Unit__c</members>
        <members>User.Entity_Address__c</members>
        <members>User.Entity_Name__c</members>
        <members>User.Sales_teams__c</members>
        <name>CustomField</name>
    </types>
    <types>
        <members>EMB_Templates/EMB_Discount_Email_Notification</members>
        <name>EmailTemplate</name>
    </types>
    <types>
        <members>Publisher_SN_Permissions</members>
        <members>Publisher_TVC_Permissions</members>
        <name>PermissionSet</name>
    </types>
    <types>
        <members>EuroFinance - Marketing Admin</members>
        <members>Media - EMB Sales %28TVC%2FSN%29</members>
        <name>Profile</name>
    </types>
    <types>
        <members>Opportunity.EMBBusOps</members>
        <members>Opportunity.EMBOpp</members>
        <members>Product2.EconProducts</members>
        <name>RecordType</name>
    </types>
    <types>
        <members>SN_Management</members>
        <members>TVC_Management</members>
        <name>Role</name>
    </types>
    <types>
        <members>Account.Legacy_system_mandatory_for_EuroFinance</members>
        <members>Account.Physical_Postcode_required</members>
        <members>Opportunity.Discount_Approval</members>
        <members>Opportunity.EMB_Budget_Split_Equals_100</members>
        <members>Opportunity.EMB_Budget_Split_with_Product</members>
        <name>ValidationRule</name>
    </types>
    <types>
        <members>Opportunity.Mail_Merge_Lex</members>
        <name>WebLink</name>
    </types>
    <types>
        <members>Opportunity.UpdateEuroFinanceSplit</members>
        <members>Opportunity.UpdateSignalNoiseSplit</members>
        <members>Opportunity.UpdateTVCSplit</members>
        <members>OpportunityLineItem.UpdateEuroFinanceProductGroup</members>
        <members>OpportunityLineItem.UpdateSignalNoiseProductGroup</members>
        <members>OpportunityLineItem.UpdateTVCProductGroup</members>
        <name>WorkflowFieldUpdate</name>
    </types>
    <types>
        <members>Opportunity.EMB Event Opp - 100%25 Event</members>
        <members>Opportunity.EMB Update Budget Split</members>
        <members>OpportunityLineItem.Update EuroFinance Product Group from Product</members>
        <members>OpportunityLineItem.Update Signal Noise Product Group from Product</members>
        <members>OpportunityLineItem.Update TVC Product Group from Product</members>
        <name>WorkflowRule</name>
    </types>
    <version>46.0</version>
</Package>

We have tried removing the profiles and permission sets from it already, in case it was that which was causing it. 
Nikhil SutharNikhil Suthar
What are you using to deploy and There are three errors occuring on components not in the package.xml what is that three errors ??
Eleanor Matthewman 8Eleanor Matthewman 8
We are using the terminal within vscode and using the command "sfdx force:source:deploy ". The force-app folder currently contains almost everything in our org (thousands of components!) The errors occuring are to do with fields not in the package.xml. If removethe fields from our force-app folder, then we no longer yet the errors and get a succssful deployment (or at least passing validation), but it is deploy 322 components and we are nervous about what components itis deploy to avoid things being overwritten that shouldn't be.
Nikhil SutharNikhil Suthar
Then you can first deploy the fields and then you can deploy remaining .I think it should work