-
Notifications
You must be signed in to change notification settings - Fork 78
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
sfdx force:source:deploy with specified manifest having specific fields deploys everything in the local object folder #156
Comments
has anyone found a workaround? this seems to be saying that we shouldn't be using sfdx for deployments if we dont have fine grained control over object deployments. |
I have experienced this exact same thing. Hoping someone has a workaround other than using force:mdapi. |
can we use mdapi with the source format? We're using sfdx with manifest at the moment so our format is all source. If we have to convert the source every time to deploy mdapi that would be a pretty janky workaround. |
The best workaround I have is this: Using the same package.xml for source you can: sfdx force:mdapi:retrieve -k package.xml -r deploy then sfdx force:mdapi:deploy -f deploy/unpackaged.zip This will at least deploy only what you want. But yes, it would be better if we could just source. |
My workaround is similar but on the retrieving end. I wrote a plugin that first wipes the object folders and then doest the force:source:retrieve. This way what is in your local is only what is in the package.xml. Still not ideal but it is the best I have for now. I wonder if we should open an issue with jsforce since that is what the plugin is using internally. |
Hi, can you provide more information on why you would only want only 1 custom object field instead of the full object and its fields? Just trying to get to the bottom of the use case. |
A single field deployment can increase in scope to 400+ items because the full object is being included in the deployment. thats 399 possible points of failure that have nothing to do with the intent of the deployment. this relates to deployments of additional fields after the initial deployment has been completed sometime in the past. Until that day that we can do bare-metal deployments to production we need to be able to incrementally deploy changes. |
@eric-bw Thank you! This is about both speed and decreasing the risk of the deployment |
@clairebianchi more importantly, there are many times where you may have parallel projects going live at different times with some overlap on objects. For example, if Team A is implementing a quoting solution and team B is implementing a field service solution, both teams will be adding or updating different metadata on the Account object. Rather than trying to merge every change that is introduced upstream in a QA environment which can be tedious with XML documents, we should be able to trust that if we specify a single CustomField to be deployed that the entire object is not deployed. Since it is deploying more than what is specified in the package manifest, the release manager may be unknowingly overwriting a larger number of changes on the related object even though the manifest does not indicate it. |
@dmgerow, thank you, that is great feedback. I am adding a story to our backlog and when we get into planning after dreamforce I will see where it fits in. |
Hi @clairebianchi this behaviour should also apply to the command force:source:convert -x which is currently keeping the whole object in the target folder even when you only specified a single part of it. Thanks! |
Hi @clairebianchi, as mentioned by @payensa-sf this also happens when using the convert command, so we're still using ant for packaging before committing it to source control. Thank you! Update: Although we found a workaround, VSCode plugin: ForceCode |
Hi @clairebianchi, I'd like to bring you an other user case: here in company we have a few custom fields for an object from a managed package. In this scenario, I want to deploy only my custom field. |
We are facing the same issue, then we search for some plugins to help with managing our folders to keep on it only metadata that is in the manifesto. Here it is one of them that we are testing: sfdx-essentials, then the option: filter-metadatas Hope Salesforce could provide some help and give some attention to it. |
Other good information based on documentation. source:deployParameters To deploy all components listed in a manifest: Based on that, think that our developers are able to believe that when we provide the manifest file on deploy command, only changes inside it will be considered on deploy. |
I noticed this behavior recently as well and hope that it is fixed soon. Until then, if you only need to deploy a few fields, one small work around is to right-click the individual field (or other object component) in the Explorer bar and select: Both of these will deploy just the field (or item) selected and not the entire object. I also noticed that when retrieving Custom Fields with the manifest from my dev sandbox, that CLI added a 'shell' metadata file for the parent object. Subsequently attempting to deploy this same manifest to our release sandbox resulted in an error because the shell metadata file for the parent object was incomplete. Manually deleting the shell file(s) allowed the custom fields to be deployed successfully using the manifest |
We went this direction as well. the issue I run still is that sfdx requires the object definition still, if its incomplete or a standard object, you end up in a situation where you have to generate a fake object definition or try to grab a full source from somewhere. There seems to be a separate bug where retrieving an object will pull an incomplete object definition (missing label, name elements, etc). Overall the need is about being able to deploy sub definitions (fields, validation rules) without needing any additional metadata as well as not deploying the whole object. The current workarounds have a number of pitfalls. |
I am experiencing the same issue using VSC/Bitbucket (with Pipelines). Of the solutions above, has anyone been able to effectively isolate only changes that have been explicitly listed in the package.xml? We do not want to deploy the entire object if only one field was updated. Any help would be greatly appreciated! |
I am sure everyone is aware, but I hate assumptions, so... The same happens using the For example, I only had 7 metadata files in my local
it deployed my webLink, and it also deployed the other 6 metadata items (1 businessProcess, 2 fields, 1 recordType and 2 validationRules). That complicated matters when I was trying to do a specific, targeted change in a sandbox, because I did not want those validation rules deployed. I had to then deactivate them. No huge deal in this case (pun intended), but if I had a lot more metadata in my folders it would have been a big headache - either to deactivate or remove all that got accidentally deployed, or to have to create a new sandbox and re-do work there because this one got too kludgey. |
Can you please provide details on how to use Forcecode to deploy package.xml |
I have a similar issue while deploying workflow rules/field updates/alerts. |
I encountered this error today and fixed by wrapping my manifest file path in double quotes. @oclif/plugin-autocomplete 0.3.0 (core) |
Still same problem here... I want to NOT deploy ListViews, and whereas is empty in my package.xml, they are all deployed with their parent object... Package XML sample: <types>
<members>Account</members>
<name>CustomObject</name>
</types>
<types>
<name>ListView</name>
</types> Sample of force:source:deploy result log Account.ComptesFelix ListView force-app\main\default\objects\Account\listViews\ComptesFelix.listView-meta.xml
Account.Fournisseurs ListView force-app\main\default\objects\Account\listViews\Fournisseurs.listView-meta.xml
Account.MesComptes ListView force-app\main\default\objects\Account\listViews\MesComptes.listView-meta.xml |
Hi @amphro , I have the same issue. I want to deploy only changes in Lead.object file (search layout changes) and changes in custom field in Lead object. When I execute deploy sfdx force:source:deploy -x "path/to/package.xml" all components in Lead object folder is deployed. I attach screenshot of package.xml file and deployment results: This is a problem because when we deploy changes in next environment, we are modifying other components with older versions. Could you help us? |
Summary
When using the org development model, the salesforce cli will deploy the entire object file if you specify a package.xml specifying child components of that object (ValidationRule,CustomField,etc.).
Steps To Reproduce:
Scenario: You want to deploy a single custom field from your workspace (that is in dx format) to a Sandbox (org development model).
Expected result
I would expect that the cli zips up that specific custom field and deploys it to the target org, with the below package.xml:
Actual result
The cli generates an object file with every single component in my local directory related to the custom object (fields, record types, etc.), and creates the following (incorrect) package.xml:
It then proceed to deploy all of that metadata instead of the single custom field that should have been deployed.
Additional information
The only workaround I have is to add all of the unwanted components to the forceIgnore file which is not reasonable for hundred to thousands of components when I want to deploy a single field.
SFDX CLI Version:
SFDX plugin Version:
OS and version:
The text was updated successfully, but these errors were encountered: