Skip to content
This repository has been archived by the owner on Oct 23, 2022. It is now read-only.

changeset create: handle properties of complex Metadata Types (e.g. CustomObject) #13

Closed
amtrack opened this issue Mar 22, 2016 · 14 comments

Comments

@amtrack
Copy link
Owner

amtrack commented Mar 22, 2016

Handling changes in named children of complex Metadata Types is already supported (changes in a CustomField within a CustomObject).
However changes in properties of its own Metadata Type aren't supported yet (e.g. searchLayouts of a CustomObject).

The approach should be as @froucher drafted:

Given we create a change set with force-dev-tool
When a list of independent child is added/modified
Then it will create a change set with the list of independent "component" 
 And excluding any metadata of the parent metadata

Given we create a change set with force-dev-tool
When a list property that doesn't belong to an independent child is added/modified
Then it will create a change set with the all "metadata" 
 And excluding all independent child metadata

Given we create a change set with force-dev-tool
When a list of independent child is added/modified
 And a list property that doesn't belong to an independent child is added/modified
Then it will create a independent "component" with the property value
 And it will create a change set with the all "metadata" 

Looking at the code, I think most of the changes could be applied in metadata-file-container.js (parse, diff, toString).

@amtrack amtrack changed the title changeset create: regard CustomObject properties changeset create: handle CustomObject properties Apr 1, 2016
@amtrack amtrack added this to the v1.0.0 milestone Jul 22, 2016
@amtrack amtrack removed this from the v1.0.0 milestone Apr 10, 2018
@amtrack amtrack changed the title changeset create: handle CustomObject properties changeset create: handle properties of complex Metadata Types (e.g. CustomObject) Apr 1, 2020
@froucher
Copy link
Contributor

froucher commented Apr 1, 2020

Hello,

Then I will start with this PR.

Sorry but I think I found some issues in the behaviours definition:

Given a list of independent child that has been added/modified in the git repository
 When a user launches a change set with force-dev-tool
 Then it will create this change set with the list of independent "component" 
  And excluding any metadata of the parent metadata

Given a list of parent properties that doesn't belong to an independent child has been added/modified/removed in the git repository
 When a user launches a change set with force-dev-tool
 Then it will create this change set with all parent metadata
  And excluding all independent child metadata

Given a list of independent child has been added/modified in the git repository
  And a list of parent properties that doesn't belong to an independent child has been added/modified/removed in the git repository
 When a user launches this change set with force-dev-tool
 Then it will create a change set with the list of independent "component" and with all parent metadata

Right now, I am not sure about which must be the behaviour when some independent child is removed. @amtrack can you help me defining which is the expected behaviour?

Thanks and regards

@froucher
Copy link
Contributor

froucher commented Apr 1, 2020

Hi again,

Maybe the behaviour with a removed child is:

Given a list of independent child has been removed in the git repository
 When a user launches this change set with force-dev-tool
 Then it will create a destructive change with the list of independent "component"

Given a list of independent child has been removed in the git repository
  And a list of parent properties that doesn't belong to an independent child has been added/modified/removed in the git repository
 When a user launches this change set with force-dev-tool
 Then it will create a destructive change with the list of independent "component"
  And it will create this change set with all parent metadata

Thanks

@amtrack
Copy link
Owner Author

amtrack commented Apr 2, 2020

@froucher your last comment seems to be correct.

BTW creating a destructiveChanges.xml for e.g. a CustomField is already implemented: https://github.com/amtrack/sfdx-playground/tree/objects/config/deployments/expected

@froucher
Copy link
Contributor

froucher commented Apr 2, 2020

ok, thanks, I will keep you informed with the progress of the PR

@amtrack
Copy link
Owner Author

amtrack commented Apr 2, 2020

Thank you!

@froucher
Copy link
Contributor

This is the PR #230 that we are working

@froucher
Copy link
Contributor

froucher commented Apr 21, 2020

Hello @amtrack, I am working to develop Compact Layout changes.

The PR #230, right now, works fine, it deploys right the changeset with new compact Layout.

Now I have found a new issue with Compact Layout, the destructiveChange.xml with compactLayout need to considered as a different component as the parent object to be removed.

This means that the solution need to consider CompactLayout as parent metadata when it is new or modification, but when it is removed it needs to be consider as a child component.

Do you agree with this?

Thanks

@amtrack
Copy link
Owner Author

amtrack commented Apr 23, 2020

@froucher I think CompactLayout can be treated as a named (standalone) metadata type.
I've adjusted the test. Please cherry-pick the commit if you agree: 72c2bca

Looking at the docs, I think the following indicates that the Metadata Type can be retrieved/deployed individually:

This type extends the Metadata metadata type and inherits its fullName field.

@froucher
Copy link
Contributor

Hello @amtrack,

This is related to the issue #226, which talks about Compact Layout deployment and how it depends on 'label' property. We thought that the way to resolve this is that compact Layout was not treated as a named metadata.

Now, maybe we need to think about other solution.

Do you agree?

Thanks

@amtrack
Copy link
Owner Author

amtrack commented Apr 23, 2020

So the initial assumption about CompactLayout was wrong but we now know that CompactLayout can be treated similar to CustomField as an independent and named child type.

On the other hand, SearchLayouts still have to be seen as an essential part of CustomObject. I think the solution you developed is still very much needed.
We just have to be clear about which Metadata Type requires which solution.

@froucher
Copy link
Contributor

froucher commented Apr 27, 2020

Yes, you are right, thanks, I have checked your commit with Compact Layout test and it is an independent child, I do a rollback of the related changes, and I will fix that currently force-dev-tool creates a wrong package.xml:

<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
    <types>
-        <members>CustomObjectTest__c</members>
-        <name>CustomObject</name>
+        <members>CustomObjectTest__c.compactLayoutTest</members>
+        <name>CompactLayout</name>
    </types>
    <version>46.0</version>
</Package>

@froucher
Copy link
Contributor

Hello @amtrack,

It seems it was very easy to resolve "Compact Layout" fix.

Please check the 723f8bd commit, I have added "isNamed: true" in the "lib/describe-metadata-service.js". Is it right?

Thanks

@froucher
Copy link
Contributor

froucher commented Apr 28, 2020

About SearchLayouts, it is working, I have added two tests in the following commit a228d8c

@amtrack
Copy link
Owner Author

amtrack commented May 12, 2020

🎉 This issue has been resolved in version 2.6.2 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants