Skip to content

CLI to import & export Drawloop Document Packages for Salesforce, in Git-friendly format

Notifications You must be signed in to change notification settings

rbauction/ddpmigrator

Repository files navigation

DDP migrator

Tool to manage Drawloop for Salesforce documents and make them Git-friendly

This tool has been designed as an alternative to Drawloop's DDP migration tool that migrates DDPs from one sandbox to another which doesn't allow to version control DDPs. In addition every once in a while work-in-progress DDPs get promoted to higher environments. The tool addresses these issues by allowing to pull and push DDP files and corresponding data (stored in Loop__* objects) to/from a Salesforce org. Data is stored in YAML so any small changes are easily seen in git diff.

Installation

One can either use Python sources or a Windows executable.

  1. Install YAML library
pip install PyYAML
  1. Install SFDC library
pip install sfdclib
  1. Add text field DDP_Migrator_Id__c (Length=36, External ID, Unique, Case sensitive) to the following custom objects:
  • DDP: Loop__DDP__c
  • DDP File: Loop__DDP_File__c
  • Delivery Option: Loop__DDP_Integration_Option__c
  • Relationship: Loop__Related_Object__c
  • Relationship: Loop__PDF_Stamp__c
  1. Execute PopulateGuids.apex script to set values in DDP_Migrator_Id__c field in all five objects
  2. Deploy triggers and a class stored in metadata directory.

It is recommended to populate GUIDs/external IDs in Production org first and then push IDs to lower environments using push-ids command.

How to package Windows executable

Install PyInstaller and then run the following command:

pyinstaller ddpmigrator.spec

Resulting exe file can be found in dist directory.

Usage

Export

The tool exports data and documents into the directory specified by --source-dir switch. It creates loop directory in the source directory and data and documents sub-directories.

Export all DDPs

ddpmigrator.py export --sandbox --username user@domain.com.sandbox_name --password Secret --source-dir ..

Export two DDPs

ddpmigrator.py export --sandbox --username user@domain.com.sandbox_name --password Secret --source-dir .. --ddp "DDP one" "DDP two"

Push external IDs

This command is useful during rollout of DDP migrator to make sure external IDs in production and all sandboxes match. It will push external IDs stored in the source directory to a sandbox.

Update all external IDs

ddpmigrator.py push-ids --sandbox --username user@domain.com.sandbox_name --password Secret --source-dir ..

Import

The tool expects the source directory to be a Git repository so it can run 'git diff' to find changes.

Import DDPs changed since certain commit

ddpmigrator.py import --sandbox --username user@domain.com.sandbox_name --password Secret --source-dir .. --baseline 6771fbc7

Import specific DDPs

ddpmigrator.py import --sandbox --username user@domain.com.sandbox_name --password Secret --source-dir .. --d "DDP one" "DDP two"

About

CLI to import & export Drawloop Document Packages for Salesforce, in Git-friendly format

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published