Book Image

MuleSoft for Salesforce Developers

By : Arul Christhuraj Alphonse, Alexandra Martinez, Akshata Sawant
Book Image

MuleSoft for Salesforce Developers

By: Arul Christhuraj Alphonse, Alexandra Martinez, Akshata Sawant

Overview of this book

MuleSoft for Salesforce Developers will help you build state-of-the-art enterprise solutions with flexible and scalable integration capabilities using MuleSoft’s Anypoint Platform and Anypoint Studio. If you’re a Salesforce developer looking to get started with this useful tool, look no further. This book will get you up to speed in no time, leveling up your integration developer skills. This essential guide will first introduce you to the fundamentals of MuleSoft and API-led connectivity, before walking you through the API life cycle and the Anypoint Studio IDE. Once you have the IDE set up, you’ll be ready to create Mule applications. You’ll look at the core components of MuleSoft and Anypoint Platform, and before long you’ll know how to build, transform, secure, test, and deploy applications using the wide range of components available to you. Finally, you’ll learn about using connectors to integrate MuleSoft with Salesforce and to fulfill a number of use cases, which will be covered in depth, along with interview and certification tips. By the end of this book, you will be confident building MuleSoft integrations at an enterprise scale and be able to gain the fundamental MuleSoft certification – MCD.
Table of Contents (21 chapters)
1
Part 1:Getting Started with MuleSoft
7
Part 2: A Deep Dive into MuleSoft
14
Part 3: Integration with Salesforce and Other Connectors

Understanding the need for an integration tool

If you come from a Salesforce background, you might not be 100% familiar with the usefulness of an integration tool such as MuleSoft. Before we dive into MuleSoft, let’s first understand why we need an integration tool and what low-code or no-code technologies are.

Introducing no-code and low-code technologies

Programming and software development have been evolving over the years. At first, programmers needed to manually translate the behavior they wanted into computer code. You needed to study a programming language, practice it, and really polish it to be able to create unimaginable programs. Eventually, this transformed into human-readable words that you could input into the machine and it would automatically know what you meant.

Fast-forward to the year 2022 and you don’t even have to input words for the computer to know what you want to do. Computers are now good enough to work with icons, buttons, or drag-and-drop components. You don’t need to memorize commands; you just need an introduction to the tool and some practice to be proficient in it. What a blessing!

Of course, there might still be some need to write code in order to have more customized behavior that fits into more complex needs for the tool; but code in general, or a programming language, is easier to understand every time. 

Let’s now look into both no-code and low-code technologies in more detail.

No-code technologies

There are some applications that you can use that involve no coding whatsoever. A few examples that come to mind are Trello for project management, Canva for graphic design, or Zapier for integration/automation. You can use them without needing to know a programming language. It’s all done through clicks and configurations.

For example, Zapier and other tools such as If This Then That (IFTTT) are very popular because you only need your browser to access them. There’s no need to install an application on your computer or perform updates to your software. You can simply type the site name into your browser, create an account, and start using it right away. Of course, there is a learning curve to understanding how to use them. But this can be overcome in a matter of hours or days, not years of a professional career. With these kinds of integration tools, there are predefined apps that you can connect to through their Graphical User Interfaces (GUIs), such as Google Calendar, GitHub, and Philips Hue. You can create specific triggers to automate your day-to-day work. An example that comes to mind is sending a Slack message as soon as a commit is pushed in GitHub. You can just click through the flow to sign in to your accounts from these different services and you don’t even need to understand how their code works. That is the beauty of no-code technologies.

Low-code technologies

In low-code tools, you can still take advantage of drag and drop, clicks, and configurations, but there might be some coding involved for more precise functionality. However, programming is not the majority of the work. The technology does not revolve around the programming language; rather, it is considered a feature of the overall product. This is the case for Salesforce with Apex and MuleSoft with DataWeave. You can use Salesforce and MuleSoft without the need to use their programming languages, but they are available for you in case you need custom functionality.

We will look into these in more detail later in the book, but if you’re completely new to MuleSoft, picture this: you have a palette of connectors you can choose from. There is a Salesforce connector, a Workday connector, and a Slack connector, and they are ready for you to just drag and drop onto a canvas. Imagine these as building blocks that you take and start building something new. Alone they might not be super useful, but together they create utility applications. Well, you can take these connectors and build some logic. You’re building a backend application without the need to know how to code. The learning curve is smaller than trying to learn a programming language from scratch, because the visual assets help you to get a better understanding of what you’re building, instead of having to read actual code and understand what it does.

Let’s say that you have two variables: a and b. You want to compare whether b is greater than a and print b is greater than a, or a is greater than or equal to b otherwise. To do this in Python, it would look like this:

a = 1
b = 5
if b > a:
    print("b is greater than a")
else:
    print("a is greater than or equal to b")

Python is one of the languages that has a more human-readable syntax. Even if you don’t know Python, you’ll be able to read this code. However, you do have to get familiar with the syntax to know how to create this piece of code.

Now, let’s take a look at the same functionality, but using MuleSoft’s Anypoint Studio (MuleSoft’s Integrated Development Environment (IDE)). Remember that this is a visual flow where you can follow the components through icons, instead of just code. It would look something like this:

Figure 1.1 – Flow from Anypoint Studio

Figure 1.1 – Flow from Anypoint Studio

There is still some syntax involved. In Python, you wrote the condition as b > a, but in MuleSoft, our condition is vars.b > vars.a. So, MuleSoft is not completely free of code. But the majority of the components we used here did not involve writing code; they were connectors that can be configured in the canvas by drag-and-dropping.

Analyzing integrations

We can look at integration as some sort of translator that will allow system A and system B to talk with each other even if they both speak different languages. A quick analogy that comes to mind is if, for example, you speak English and need to speak with someone in Spanish; you can use a translator app on your phone to help you communicate with the other person. You don’t need to learn Spanish and the other person doesn’t need to learn English in order for you two to communicate effectively. This is achieved, thanks to your mobile device or the mobile application that you downloaded (the integrator).

Let’s now look into a technical example to demonstrate what integration does. If you’re not familiar with JavaScript Object Notation (JSON), it’s a type of data that is widely used nowadays because of its simplicity and easiness to read.

Let’s say that system A uses the following JSON object to describe a person. It contains the ID, FirstName, and LastName fields:

systemA-person.json

{
"ID": 1,
"FirstName": "Alexandra",
"LastName": "Martinez"
}

However, system B uses a different JSON structure to describe a person. Instead of the ID field, it uses id, instead of FirstName, it uses firstName, and instead of LastName, it uses lastName:

systemB-person.json

{
"id": 1,
"firstName": "Alexandra",
"lastName": "Martinez"
}

For a human, this might seem like a pretty straightforward transformation. The fields have the same names; they just have different upper- and lowercase letters. However, for a computer program, these fields are completely different. You need an integration that will help system A and system B to effectively communicate with each other even though their fields are different.

Of course, this example is simple compared to real use cases. This is just to give you a better idea of why you would need integration to connect different systems. In the real world, this data can be as short as what was just demonstrated or as long as 2,000 fields at a time.

Now imagine that we not only have to connect different data structures from system A to system B but also need to connect systems C, D, E, and F. All of them have their own data structures. Some of them don’t even use JSON; they use other data types, such as CSV or XML. It would be a lot of work to manually create code to be able to talk within all of these systems. Instead of creating a huge, tightly coupled, and hard-to-maintain application to connect them all, you can create small and easy-to-maintain Application Programming Interfaces (APIs) that will help you to integrate all of these systems and even leave space for any changes to the integrations that can be easily done. You’re not stuck with a ton of dependencies within the same project, but have different microservices to manage your whole application network, which brings us to our next topic.