This problem analyzer fixes a split metadata sections that cause validation and deployment errors.
This PA applies to metadata indiscriminately - if you find that this is applying to metadata that you think it shouldn’t, please get in touch with our support team here
What triggers this problem analyzer?
When metadata contains split XML sections at the same level of indentation, Salesforce will return a validation or deployment error about an element being duplicated.
Example:
What problem is it solving?
It isn't possible to deploy metadata that has split XML sections that are at the same level of indentation.
Example:
<CustomApplication>
<profileActionOverrides>A</profileActionOverrides>
<profileActionOverrides>B</profileActionOverrides>
<name>appName</name>
<profileActionOverrides>C</profileActionOverrides>
</CustomApplication>
In the above <profileActionOverrides>C</profileActionOverrides> is not grouped together with the other profileActionOverrides. If we were to try and deploy the CustomApplication like this it would fail due to the error - Error parsing file: Element profileActionOverrides is duplicated at this location in type CustomApplication.
This can happen due to editing the file outside of Gearset either by adding new metadata fields in the wrong location or a manual merge resolution.
How does it work?
Gearset will auto group each field at the same level without changing the ordering of the individual fields within that group.
Example:
Custom Application with split metadata sections
<CustomApplication>
<profileActionOverrides>A</profileActionOverrides>
<profileActionOverrides>B</profileActionOverrides>
<name>appName</name>
<tabs>A</tabs>
<profileActionOverrides>C</profileActionOverrides>
<tabs>B</tabs>
<profileActionOverrides>D</profileActionOverrides>
<tabs>C</tabs>
<element>
<field>A</field>
<name>elementName</name>
<field>B</field>
</element>
</CustomApplication>
Becomes
<CustomApplication>
<profileActionOverrides>A</profileActionOverrides>
<profileActionOverrides>B</profileActionOverrides>
<profileActionOverrides>C</profileActionOverrides>
<profileActionOverrides>D</profileActionOverrides>
<name>appName</name>
<tabs>A</tabs>
<tabs>B</tabs>
<tabs>C</tabs>
<element>
<field>A</field>
<field>B</field>
<name>elementName</name>
</element>
</CustomApplication>
Notice that the <name> elements, that are not at the same XML level of indentation, are not grouped. This Problem analyzer only looks at items at the same XML level of indentation.

