Once you are done, with Flow or Process development, the next step is to deploy it. There are many ways, through which, you can deploy or distribute, Flow(s) or Process(s), from one org to another:
This blog is a sequel to my previous blog – Distribute Process(es) using Force.com IDE. In the previous blog, I discussed how to deploy Flow(s), or Process(es), using the Force.com IDE.
Today, I am going to discuss how to deploy a Process(s) or Flow(s) using the MavensMate. MavensMate is a collection of open source projects. Its aim is to enable developers, who prefer to build applications using their local machine in text editors like Sublime Text, Atom, and Visual Studio Code –, to build Salesforce applications.
MavensMate also allows developers to deploy the metadata components like Flows and Processes in different environments – such as, Developer Edition org and Production Org. Let’s start with a business use case.
Business Use Case
Pamela Kline is working as System administrator at Universal Containers. She has developed a Process (Getting Started with Process Builder – Part 67 (How to fix MALFORMED_ID error) in UAT Sandbox and is done with testing. Now, she wants to deploy the process to her production org.
Solution for the above business requirement
There are few possible solutions for the above business scenario. But, today we will use MavensMate to deploy the process from Sandbox to Production org.
Before proceeding, install MavensMate. Let us start with setting up MavensMate and Sublime Text a sophisticated cross-platform text editor to write code.
For our current business scenario, we do not need to install Sublime Text. But, if you want to develop, or modify Apex code, then, you will need to install and configure, Sublime Text Editor.
Setup Sublime Text 3 and MavensMate
1. The very first step is to download and install Sublime Text 3. It is available for Windows, MacOSX (10.7 or later), and Linux. Sublime Text may be downloaded and evaluated for free; however, a license must be purchased for continued use. There is currently no enforced time limit for the evaluation period.
Now navigate to Sublime Text 3 download page and install it on your workstation.
2. The next step is to Install Package Control. Package Control is the Sublime Text package manager, and it is one of the simplest methods of package management. Follow the instructions to run package control code on Sublime Text 3.
- First of all, open Package Control installation page.
- Copy the complete Python code for your version of Sublime Text i.e. version 3 for our current scenario.
- The next step is to open Sublime Text 3 and navigate to View | Show Console
- Paste the copied Python code to console and click Enter.
3. The final step is to install MavensMate on your workstation. Open MavensMate download page, and download appropriate MavensMate on your workstation.
Once it is successfully downloaded, make sure to install it.
4. You may want to setup workspace for MavensMate to store all your metadata in one folder. To do so open MavensMate first; then, open Sublime Text 3 and navigate to MavensMate | Settings | Global Settings (In Sublime Text editor). Under WORKSPACES(MM_WORKSPACE) set the location where you want to save your metadata components. If you, however, have multiple workstations then, it is a good idea to use cloud services – like Google Drive – to store all your codes/metadata components. Storing codes/metadata components in the cloud will enable you to access it from anywhere, as shown in the following screenshot:
Migrate metadata components using MavensMate
Follow the instructions to create a Project and deploy it to another Salesforce org using MavensMate
1. Open MavensMate and then, click on New Project.
2. The next step is to select Salesforce Environment Type i.e. Sandbox in our case, and then, click on Connect button, as shown in the following screenshot:
MavensMate uses the OAuth 2.0 Web Server Authentication Flow to authenticate to Salesforce. Once you click on the Connect button, it will open a pop-up for you to enter your sandbox credential. After successful login, the authentication process will grant your Sandbox access to MavensMate.
3. The next step is to setup the project details. Perform the following instructions to setup a project in MavensMate:
- Click on PROJECT DETAILS tab and enter project name – Blog 68
- Navigate to ADVANCED tab and select metadata types you need for your project. For current use case select CustomLabels and Flow.
- Navigate to METADATA tab and select custom label and then, Flow that we created in Blog 67. Flows and Processes will be listed under the Flow folder, as shown in the following screenshot:
- Once you are done with components selection, click on the Create Project button, as shown in the following screenshot:
This will download metadata of selected components on your workstation.
- If you want to open metadata component in Sublime Text 3, click on Editor | Open in Sublime, as shown in the following screenshot:
- That’s all! Now you will be able to edit your Flow metadata file in Sublime Text 3.
4. At the end, we have to setup the deployment connection and then deploy Process and CustomLabel to Production org. Perform the following instructions to deploy using MavensMate.
- To setup, the Deployment Connection click on Deploy | Deployment Connections | New Deployment Connection, as shown in the following screenshot:
- Enter the Connection Name, in this scenario type Production, and then, click on Create Connection button, as shown in the following screenshot:
- In the next screen enter Salesforce Username and Salesforce Environment Type Production, for the current scenario. Once you are done, click on the Connect button, as shown in the following screenshot:
- This will open a pop-up for you to enter your Production credential. After successful login, the process will grant your Production org access to MavensMate.
- After successful deployment connection set up, the final step is to deploy metadata components. To do so click on Go to Deploy to Server button.
Now you have to select few details like target org, metadata etc.
- Click on TARGETS tab, move Production from Deployment Connections to Deployment Targets, as shown in the following screenshot:
- Under OPTIONS tab, select Validate Only, RollBack on Error and Run All Tests options.
- Under METADATA tab, make sure that you have selected all metadata components and their dependencies, as shown in the following screenshot:
- Once done, click on the Validate Deployment button, as shown in the preceding screenshot.
- You should receive, Your validation completed successfully, message as shown in the following screenshot
Navigate to OPTIONS tab and unselect Validate Only checkbox. Once you do that, you should see Deploy to Server button.
- Click on Deploy to Server button to deploy Process and Custom Label to Production org. Once deployment is Successful, you will get the following message, as shown in the following screenshot:
5. At long last, here comes the final step! Go ahead and activate the Process by navigating to Setup | Build | Create | Workflows & Approvals | Process Builder and open the deployed Process. You are done!
Technical Editor and Proofreader: - Munira Majmundar