sfdx-isv / territory-management-toolkit

The Territory Management Toolkit (TM-Tools) is a Salesforce CLI Plugin that provides tools for simplifying the migration of a Salesforce org from Territory Management (TM1) to Enterprise Territory Management (TM2).
BSD 3-Clause "New" or "Revised" License
9 stars 0 forks source link

Some XML files (eg. package.xml) have doubled-up contents #2

Closed VivekMChawla closed 5 years ago

VivekMChawla commented 5 years ago

The package.xml file should look like this:

<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
    <types>
        <members>*</members>
        <name>Territory2</name>
    </types>
    <types>
        <members>*</members>
        <name>Territory2Model</name>
    </types>
    <types>
        <members>*</members>
        <name>Territory2Rule</name>
    </types>
    <types>
        <members>*</members>
        <name>Territory2Type</name>
    </types>
    <version>45.0</version>
</Package>

But after the tm-tools:tm1:transform process completes, the user is provided with a package.xml file that looks like this:

<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
    <types>
        <members>*</members>
        <name>Territory2</name>
    </types>
    <types>
        <members>*</members>
        <name>Territory2Model</name>
    </types>
    <types>
        <members>*</members>
        <name>Territory2Rule</name>
    </types>
    <types>
        <members>*</members>
        <name>Territory2Type</name>
    </types>
    <version>45.0</version>
    <types>
        <members>*</members>
        <name>Territory2</name>
    </types>
    <types>
        <members>*</members>
        <name>Territory2Model</name>
    </types>
    <types>
        <members>*</members>
        <name>Territory2Rule</name>
    </types>
    <types>
        <members>*</members>
        <name>Territory2Type</name>
    </types>
    <version>45.0</version>
</Package>

This is also happening with the territory2Type file. Not sure, but it might have happened with the territory2Model file as well.

At the outset, it looks like all of the NEW XML files I'm creating are getting doubled up.

NOTE: We need to make sure that this is not happening because we've called the same operation twice on the same folder.

It's possible that the XML tool we use is somehow additive to existing directory contents. Not sure if that's true, but it's a lead we'll need to chase down.

VivekMChawla commented 5 years ago

This may have been due to the presence of DEVTEST code that was calling the write command a second time (unexpectedly).

I removed the DEVTEST code and the problem seems to have gone away. I'll keep this bug open for now but if we don't see this again soon I think we squashed this one.

VivekMChawla commented 5 years ago

The fix mentioned in the previous comment appears to have held up. Closing this bug now.