Getting Started with Process Builder – Part 68 (Deploy Flow(s) or Process(es) Using MavensMate)

Getting Started with Process Builder – Part 68 (Deploy Flow(s) or Process(es) Using MavensMate)

Last Updated on November 23, 2020 by Rakesh Gupta

Big Idea or Enduring Question:

How do you deploy Flows or Processes using MavensMate?  

Objectives:

After reading this blog post, the reader will be able to:

  • Understand how to use MavensMate to deploy flows
  • Understand how to use MavensMate to deploy processes
  • Deploy components to any org using MavensMate

Business Use Case

Pamela Kline is working as a 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. 

Automation Champion Approach (I-do):

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.

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.Package Control installation code
  • The next step is to open Sublime Text 3 and navigate to View | Show Console Open Sublime Text Console
  • Paste the copied Python code to the console and click Enter

3. The final step is to install MavensMate on your workstation. Open MavensMate download page, and download the appropriate MavensMate on your workstation.

MavensMate download page

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:

Workspace Setup

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.

Create a new project
Create a 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: 

Select Salesforce environment type
Select Salesforce environment type

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

    Project Details
    Project Details
  • Navigate to ADVANCED tab and select metadata types you need for your project. For current use case select CustomLabels and Flow.

    select metadata types
    Select metadata types
  • 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:

    Select metadata components
    Select metadata components
  • Once you are done with components selection, click on the Create Project button, as shown in the following screenshot: 
    Create Project
    Create Project

    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:

    Open in Sublime
    Open in Sublime
  • That’s all! Now you will be able to edit your Flow metadata file in Sublime Text 3.
Sublime Text 3 - Flow Metadata
Sublime Text 3 – Flow Metadata

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:

    Set up deployment connection
    Set up deployment connection
  • Enter the Connection Name, in this scenario type Production, and then, click on Create Connection button, as shown in the following screenshot:

    Deployment connection name
    Deployment connection name
  • 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:

    Select Salesforce environment type
    Select Salesforce environment type
  • 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.
    Deploy metadata components
    Initiate deployment process

    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: 

      Deployment Targets
      Deployment Targets
    • 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:

      Metadata Selection
      Metadata Selection
    • 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
    Validation Successful
    Validation Successful

    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:
Deployment Successful
Deployment Successful

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! 

Formative Assessment:

I want to hear from you!  

What is one thing you learned from this post? How do you envision applying this new knowledge in the real world? 

Let me know by Tweeting me at @automationchamp, or find me on LinkedIn.

Have feedback, suggestions for posts, or need more information about Salesforce online training offered by me? Say hello, and leave a message!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.