Salesforce offers a SaaS (Software as a Service) model where customers use and customize applications using class and package files. Create and store these into various Repositories such as Git and then deploy into Salesforce for a company's Salesforce based applications.

Salesforce offers different regions such as testing, preproduction, etc., where the class and package files can be deployed prior production.

Installation Instructions

First import the Salesforce Procedures into DeployHub and configure your Salesforce deployment, follow these instructions:

  • Click on the DeployHub Salesforce Deploy Action.

  • At the bottom of the page, there are 6 files. Download all of these except SalesForceDeployAction.png to a folder locally.

Install into DeployHub

  • Click on the Flows menu.
  • Click on the Functions and Procedures tab.
  • Click on a Domain and select "Import a Function or Procedure into this Domain".
  • Click the “Choose File” button to navigate to the directory where the 5 files are located, 4 of which have an extension of .re.
  • Select the file and click the Open button.
  • Click on the Import button.
  • Do the same for the,, and files.
  • Move the git-checkout file to the $HOME/scripts directory on the location where DeployHub is installed.

NOTE: Double clicking SalesForceDeployAction.png will show the arrangement of the GitCheckout, SalesForceDeploy, and SalesforceCredential Procedures within the SalesForceDeploy Action as will be described later.

Notice there are now four new Procedures in the Domain named “RunAnt” and “GitCheckout,” under the Deploy Category, as well as “SalesForceDeploy” and “SalesforceCredential,” under the SalesForce Category.

The SalesforceCredential Procedure is of the type "DMScript Procedure in Database". It contains DMScript code that takes the username/ password of the named Credential. It's a single argument and therefore uses the same username/ password to access a Salesforce region (test, prod, etc.)

The GitCheckout Procedure is of the type "Procedure provided by local external script or program". It has the following arguments:

  • GitRepo: The URL to the Git repository.
  • GitCommit: The version/commit to check out.
  • ToDirectory: Where files will be checked out to, a directory on the same server where DeployHub is installed.

The RunAnt Procedure is of the type "Procedure provided by local external script or program". It has the following arguments:

  • BuildFile: The Ant XML Build, which is a configuration file containing Ant tasks that are to be executed.
  • Target: Which target in the build file will be used when Ant is run. It references a group of tasks i.e., build, test, install, etc.

The SalesforceDeploy Procedure is of the type "DMScript Procedure in Database". It contains DMScript that deploys classes and packages into Salesforce regions (test, production, etc.). It has the following arguments:

  • User: Taken from the SalesForceCredential Procedure.
  • Password: Taken from the SalesForceCredential Procedure.
  • ServerUrl: The Salesforce region to be deployed to.
  • Repo: The Repository where the class and packages exist, typically a filesystem type Repository.
  • TestLevel: When test cases are run, which level (All, Some, etc.).

Create Salesforce Deployment Action

  • Create the Action to be used to deploy to Salesforce by right clicking on the Actions tab in the same Domain as the Procedures.
  • Select "New Action in this Domain".
  • In the Workflow tab, scroll down the Activities list on the right side and click on the plus sign next to the Salesforce Category.
  • Click and drag the Procedure that was just created named “GitCheckout” onto the Workspace.
  • Repeat with the Procedures named “SalesforceCredential” and “SalesForceDeploy,” in that order.

The following Global variables must be used as Attributes within any Components used to deploy files to Salesforce regions:

  • ${GIT_URL} = git url for the repo.  Used in the clone step executed by the procedure.
  • ${GIT_COMMIT} = the commit hash for the version to be checked out from the repo.
  • ${GIT_DIR} = temporary directory used to clone and checkout into.  This should be a known name so the Repository for the Component can find the files.

The following Global variables must be used as attributes within any Environments that are used for the purpose of deploying files to Salesforce regions:

  • ${SalesforceCredential} = name of the credential that contains the Salesforce Userid and Password.
  • ${ServerURL} = Salesforce URL for the target deployment.
  • ${SalesforceRepo} = local repository name pointing to the location in which the git step placed the files in.
  • ${TestLevel} = Salesforce Test Case Level.

The Action can now be placed into the Custom Action field of a Component as part of an Application deployed to a Salesforce region.