amtrack / force-dev-tool

[DEPRECATED] Command line tool supporting the Force.com development lifecycle
MIT License
108 stars 37 forks source link

implement factory-reset command #79

Closed amtrack closed 7 years ago

amtrack commented 7 years ago

@Szandor72, i rebased this branch on the master branch and applied a small fix.

To factory-reset an org called mydevorg the workflow would look something like this:

(add the remote first, in case you have not already)

$ force-dev-tool remote add mydevorg user pass

generate the deployable directory

$ force-dev-tool fetch --read 'ApprovalProcess FlowDefinition Layout' --progress mydevorg
$ force-dev-tool factory-reset --approval-processes --flows --layouts --delete mydevorg

run some pre-deployment tasks

$ echo "delete [SELECT Id FROM GroupMember];" | force-dev-tool execute mydevorg

and deploy

$ force-dev-tool deploy -d config/deployments/factory-reset mydevorg

If the deployment throws an error, you'll maybe have to manually adjust some things in the config/deployments/factory-reset directory for now.

For example, i just go this error:

WorkBadgeDefinition-Badge Layout
Page Layout
Layout must contain an item for required layout field: RewardFundId

I had to put the following in config/deployments/factory-reset/layouts/WorkBadgeDefinition-Badge%20Layout.layout and then it worked:

            <layoutItems>
                <behavior>Edit</behavior>
                <field>RewardFundId</field>
            </layoutItems>
Szandor72 commented 7 years ago

Cheers @amtrack

Here's Andrew's undeploy script: https://github.com/financialforcedev/df12-deployment-tools/blob/master/lib/undeploy.xml

For the most important parts it even uses javascript :) Unfortunately exactly the parts I cannot get to work