SalesForce

Deploying SalesForce objects with DeployHub Pro.

salesforce

Using a Custom Action for SalesForce Deployments

If you are developing your Applications using SaleForce, this integration will allow you to support SalesForce deployments. By creating this Custom Action you can replace the DeployHub Pro standard deployment processing engine and instead use a process designed specific to Salesforce including the mapping of DeployHub Pro Environments to different SalesForce regions such as testing, pre-production, production, where the class and package files can be deployed.

The following directions allows you to create a Custom Action using the pre-written DeployHub Pro Procedures to support a SaleForce deployment model. Once you create your SalesForce Custom Action you assign it to your SalesForce Component which will override the DeployHub Pro standard deployment engine.

Steps for Creating Your SalesForce Custom Action

You will need to create a SalesForce Custom Action that will support your SalesForce deployment . This is done by adding the DeployHub Pro pre-defined Procedures and then defining them to a Custom Action that your Component will use for deployment. For more details on creating Procedures and Actions see:

The following steps will take you through the process:

Step 1 - Create a SalesForce Repository

A Repository of the type “File System” is used to reference files pulled from Git. For this reason, you will need to create a DeployHub Pro “File System” Repository. To create this Repository see Connect Your Repositories.

Step 2 - Create a SalesForce Credential

You will need a DeployHub Pro Credential to login to Salesforce for the deployment step. To create this Credential see Create Your Credentials.

Step 3 - Create a SalesForce Environment and EndPoint

You will need to create an Endpoint and then an Environment for your SalesForce deployment. You can create as many Environments as needed based on your SalesForce Regions. See the Define Your Endpoints and Build Your Environments sections for more information. The following parameters should be used when defining your Endpoint and Environment.

  • Endpoint Detail Settings

Create a new Endpoint using the following Detail values:

Detail Field Value
Endpoint Operating System Linux
Endpoint Type Application Server
Hostname localhost
Protocol ssh
Base Directory /tmp
Credentials not required
  • Environment Attributes

Using the Attributes section of the Environment Dashboard, add the following Attributes. Use the +Add in the Attributes section to add a row to the Attributes table. You must use Save to commit the row to the table.

Variables Value
SalesforceCredential Enter the name of the Credential that contains the Salesforce Userid and Password created in step 2.
ServerURL Enter the Salesforce URL for the target deployment.
SalesforceRepo Enter the name of the File System Repository created in Step 1.
TestLevel Salesforce Test Case Level.

Step 4 - Create Your SaleForce Procedures

You will import and use pre-defined Procedures to create your Custom Action. Import the most current GitCheckout, RunAnt, SalesforceCredential and SalesforceDeploy Procedures/Functions from Ortelius Git Repo.

The following files need to be retrieved:

  • GitCheckout.re - This Procedure checks-out the files from your git repository to the DeployHub Pro eninge and then checks out the commit, branch or tag specified.

  • RunAnt.re - This Procedure runs Ant

  • SalesforceCredential.re - This Procedure exposes the credential for the Salesforce Deploy Procedure

  • SalesforceDeploy.re - This Procedure executes Ant against a dynamically created build.xml file to upload the classes to Salesforce.

Once downloaded, you will need to Import the scripts into DeployHub Pro as Procedures. To import these Procedures navigate to the Func/Procs Menu option on the left hand side of the DeployHub Pro Main Menu panel. This will take you to the Functions and Procedures List View. From the Functions and Procedures List View select the Import option. The Import will bring you to your operating system “file open” dialog box for selecting the GitCheckout.re, RunAnt.re and SalesforceCredential.re and SalesforceDeploy.re files.

Next, select your “Global,” or highest level, Domain and upload the Procedure into DeployHub Pro. If you select a lower level Sub-Domain you will restrict access. By defining it to your highest level Domain, all Users will be able to see the Procedures. Once you have both imported, you are now ready to create your Action.

Step 5 - Create your SalesForce Action using your Procedures

Once you have imported the SalesForce files as Procedures, you ready to define your Custom Action. Navigate to the Actions list view from the Actions menu option on the left hand side of the DeployHub Pro Main Menu panel.

Use the +Add option to create a new Action for you Procedure. In the “Full Domain” field select your “Global” Domain. If you select a lower level Sub-Domain you will restrict access to this Custom Action. By defining it to your highest level Domain, all Users will be able to execute the process regardless of their Sub-Domain.

Name the new Action “SalesForceAction” (no spaces).

Now we are going to customize this Action. On the right hand side, you will see a list of Functions and Procedures you can choose from. Navigate to your Domain to find the files imported as Procedures. Drag them onto the area under “Start”. The order should be:

-GitCheckout -SalesforceCredential -SalesforceDeploy

Note: RunAnt is reference by the SalesforceDeploy Procedure and does not need to be included in the Action.

When you drag your Ansible Procedures onto the area under “Start” a pop-up dialog box will open for you to complete the following parameters:

GitCheckout Parameters

Field Value Description
Title Not Required Name of the step in your deployment workflow.
Summary Not Required Enter a summary of this step.
Git Repo $GIT_URL Git Repo containing your SalesForce Source Code.
Git Commit $GIT_COMMIT The commit, tag or branch to checkout.
To Dir $GIT_DIR The directory to checkout into. Use “.” for the default directory.

SalesforceCredential Parameters

Argument Description
Credential Name Name of the Credential your created in step 2 above.

SalesforceDeploy Parameters

Argument Description
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.).

At this point the Custom Action is ready to be used by anyone with access (based on Domain and security options). Each Component that uses the Custom Action will need to define specific values. Because this new Custom Action is reusable, no Component variables are defined at the Action level.

Step 6 - Create Your SalesForce Component

Now that you have defined your SalesForce Custom Action you are ready to create your SalesForce Component. Define your Component to use a Custom Action from the Component Dashboard. See the Components Chapter for more details on creating your new Component.

Update the Custom Action Detail field by choosing the SalesForceAction provided in the Custom Action dropdown list. You will have a single parameter to update:

Parameter Description
Repository Select your SalesForce Repository.

Step 7 - Set Your Component Attributes_

The following variables must be added to the Attributes Section for all Components using the SalesForceAction Custom Action. The Attributes section can be found on the Component Dashboard. Use the +Add option in this section to add a row for the variable. You must use Save to commit the row to the table:

Variables Description
GIT_URL git url for the git repository. This is used in the git check out step executed by the SalesForce Action.
GIT_COMMIT The commit hash for the version to be checked out from the git repository.
GIT_DIR The temporary directory is used by git to clone and checkout. This parameter should be a directory defined in a DeployHub Pro Repository for the_Component_ to find the files.

You are now ready to assign your SalesForce Component to an Application and perform a deployment to one of the SalesForce Environments.