2

I have a pipeline that deploys through a command:

sfdx force:source:deploy -x manifest/package.xml -u Prod -l RunLocalTests

But my issue is even when I use a package.xml with two fields for Case,it deploys the entire case object? Is it a Normal behaviour? Is there a way I can only deploy the things I want to, instead of everything? My package.xml which deploys entire Case object:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
    <types>
        <members>Case.R2_CAS_PKL_Reason_cancelled_case__c</members>
        <members>Case.R1_CAS_PKL_SubtypeCE__c</members>
        <members>Case.R1_CAS_PKL_TypeCE__c</members>
        <name>CustomField</name>
    </types>
    <types>
        <members>Case.CCPO_profile_no_editable</members>
        <name>ValidationRule</name>
    </types>
    <version>47.0</version>
</Package>
1
  • What happens if you do this via mdapi deploy or from workbench ? Mar 17 '20 at 17:46
2

I believe this is a limitation of the package.xml format; it has to convert to mdapi format, which requires a full object. Instead, you can use the -p option:

sfdx force:source:deploy -p force-app/main/default/objects/Case/fields/R2_CAS_PKL_Reason_cancelled_case__c,force-app/main/default/objects/Case/fields/R1_CAS_PKL_SubtypeCE__c,force-app/main/default/objects/Case/fields/R1_CAS_PKL_TypeCE__c,force-app/main/default/objects/Case/validationRules/CCPO_profile_no_editable

Alternatively, if you have just the metadata you want to deploy in its own package, you could use that as well.

2
  • Thanks @SFDCfox but it is one-off basis solution.The package keeps changing every time.I have a Jenkins pipeline which kicks off after a merge request.Yes I can do it for this instance but then i have to manually sync it my version control so that future deployment which happens through a branch, should not overwrite the today's deployed changes..No?
    – Chetan
    Mar 17 '20 at 19:44
  • @Chetan There are other potential solutions, but it sounds like this isn't one of them (necessarily). There's some documentation you should read.
    – sfdcfox
    Mar 17 '20 at 20:54
0

This particular behavior is logged as issue on SFDC CLI Github : https://github.com/forcedotcom/cli/issues/156

I ran into the same issue and I have a bash script to delete the files I don't want to deploy from force-app folder but keep only the files that I want to deploy.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.