Magento and Salesforce CRM Integration: The Complete Guide

In the world of Internet business, better known as “e-commerce”, data is king. Keeping your customers, products, orders and data organized across platforms should be your top priority. Most properly organized businesses assess their needs as they grow, implementing different software platforms to keep their data in check.

Often times, the user, product and order data is spread across multiple platforms. Keeping records synchronized as traffic and business grows can become a strenuous task, and as any similar process, prone to human error. In time, spending human resources to complete those tasks becomes a liability more than anything else. You should consider connecting your systems in more structured and streamlined way when risks become too great to ignore.

One of the software combinations that is fairly common is Salesforce CRM and Magento. At Farshore, we pride ourselves in pushing the envelope on software solutions, and have an extensive experience integrating Magento with multiple other platforms.

One of those platforms is Salesforce. We should first define the systems that are being connected to better understand the requirements, issues and solutions.

Defining the Basics of Salesforce CRM and Magento Integration

If you are reading this article, there is a high probability that you are already familiar with both systems you are trying to connect. This chapter should be a reminder why you picked both Salesforce CRM and Magento to handle your business needs. If you are trying to implement multiple solutions to accommodate your business’ needs, and are looking for compatible systems, these general explanations will help you better understand what each brings to the table.

By a broadest of definitions Salesforce CRM is a hosted customer relationship management system used for handling customers, products, orders, inventory, and other features for monitoring merchandise and services. Scalability, out-of-the-box power, stability, and a possibility for a high level of customization make it a choice for a wide variety of companies ranging from multi-billion corporations to small businesses.

Although it encompasses a wide variety of possibilities and features, making it an ideal CRM choice, Salesforce CRM is generally not customized to be an e-commerce store’s back-end. There are integrations available in Salesforce.com’s AppExchange, making it possible to control the storefront almost entirely from Salesforce CRM; however, the product itself is not designed to power such a platform.

It is important to note that as a market leader, Salesforce CRM, provides the most features of any of the CRM platforms. High-quality comes with a comparatively higher price than the competition, but since this article is not a Salesforce CRM vs. the field comparison, we will leave you with the informed decision on what to use.

Magento, on the other hand, is a standard e-commerce platform based on the PHP programming language. As with Salesforce CRM, Magento has its pros and cons all depending on expectations and the level of customization you expect from your e-commerce website. If you want to maintain your site without a lot of technical knowledge or a development team, then Magento may not be your cup-of-tea.

However, if your expectations hinge on a high level of customization and mod-ability then Magento is the way to go. We recommend establishing an environment and coding team to have Magento up and running that will give you a chance to save some resources on monthly costs and will keep you tied to your technical resources long term. These factors will be of the utmost importance when aligning Magento with Salesforce CRM because you will be able to use them to develop a custom connection solution without depending on out-of-the-box applications on either end of your business.

Salesforce CRM integration with Magento

Choosing Your Approach

Once your Salesforce CRM account and Magento installation has been completed you have made the first step toward our topic for the day.

How you approach aligning your systems depends on a way you intend to use Salesforce CRM, Magento, and possibly a third solution for another niche of your business.

At this point, it is important to explain that almost all of the crucial data you want to follow and work with can be integrated between Magento and Salesforce CRM. The most important step you have to take at this point is to open up the proverbial playbook and choose the right move for the situation.

Every basic synchronization action can be done with an un-customized solution, making your life easier. You will, in all probability, communicate only with those apps’ support teams who can guide you through the entire setup process.

However, choosing such a solution will almost definitely be less cost-effective. In addition, your system’s integrity will depend on decisions made by a third-party company that is developing solutions for the general public, meaning you will not be able to customize the way it works.

Layering your data to specifically e-commerce and handling the processes coming in from the Magento side separately will again demand an involvement by a Salesforce CRM development team, be it your own or outsourced one, which will have to be working with layers of pre-made actions and code not optimized to fit your business.

If the results you are looking for include more than an updated carbon copy, you should seriously consider setting up a custom processes on both ends of your playing field.

As in the previous example, this kind of approach has its pros and cons. The most important pro is having complete control over the whole process and the option to pick and choose which parts of the apps should be synced and which ones should be left unaffected by the process. That way you will be certain that any further development is under your control.

The biggest downside of this way of implementing the synchronization is the list of requirements and the timeframe you will be dealing with. Setting up or hiring both Salesforce CRM and Magento development teams; defining requirements; and going through the development and testing process can be tasks that can take up to several months from beginning to finish.

The good news is that your teams can (and should) work on those tasks along with setting up the basic Salesforce CRM and (especially) Magento endpoints. That way you will not spend weeks on only the synchronization tasks, and you will be able to incorporate them in the core part of the whole e-business development.

At Farshore, we value tech solutions before anything else, building with a special focus on our clients’ needs. Our purpose is always to inform the client of their possibilities before building them a scalable and stable e-commerce environment.

Other companies that work with automatic solutions (both on the Salesforce CRM and Magento side), have their products defined in a straightforward manner on their websites so there is really no need to compare the finished products. That’s why I will try to provide the process guideline for the software development approach. Client-centric development of custom products is the thing we do best.

Building Toward Specific Requirements

When starting to align two complex environments, such as as Salesforce CRM and Magento, there are two general areas you need to cover in detail to be sure the end product is exactly what you want. These areas are project management and technical development. To be able to explain how the alignment process works it will inevitably have to be split into tasks that would go into separate categories.

To guide you through the process, we will also define a project by requirements similar to the ones we got by one of our most demanding clients in this area.

Project Requirements

Most companies use Salesforce CRM as their solution for all their CRM purposes. Using this scenario, we will work with the environments and requirements as follows:

  1. The client is using Salesforce CRM for all of their CRM needs
  2. The client has hired a Salesforce CRM development team to develop upgrades to the system and has internal development resources to maintain the system
  3. The client wants to add the e-commerce site to their portfolio with the following relevant functionalities:
    • System will be using Salesforce CRM defined products made for e-commerce use exclusively
    • System will be utilizing the PayPal payment gateway that is already connected to Salesforce CRM
    • System will have to access the same tax API that Salesforce CRM is already using
    • System will have to send all the order, media and user data to Salesforce CRM thus creating opportunities and cases
    • System will have to be able to use Salesforce CRM defined coupon codes both as codes and additional products
    • System will not create users but use only the entered data to send the order and the rest of the data

These definitions were described in more detail in the project we are referring to but for the purposes of this article the details are more than enough to paint the picture of how the project should run.

Salesforce

Stepping into Project Management

Once the requirements are defined and the Magento system drawn out we can start putting in the work that will ensure that the technical process goes as planned. These steps are good practice in any project; however, they are crucial for the effort to be successful and as pain-free as possible when connecting several teams and platforms.

Most important layers in defining this part of the process:

  1. Communication channels

Dealing with several teams on any task in any industry is a strenuous task in its own right. It goes without saying that the whole process could be in jeopardy without a frequent and well-structured communication system between development teams and the client.

That’s why it is crucial to define point persons in each team who will be able to lead the conversation, ask the right questions, and offer solutions in a structured and timely manner. That way you will have a structure in place where each team will have a communication avenue to explore and collaborate when needed.

You could experience issues with understanding the requirements, timelines, and responsibilities from the beginning if this part of the process is not properly setup.

  1. Responsibility matrix

Once the communication structure is defined, it will be much easier to break tasks into categories and assign responsibilities. Each team needs to be aware of what is expected of them with properly defined responsibilities.

It is unacceptable for the client to not know at which point what part of the product is developed and who’s responsible for each project component.

  1. Risks

Same as the previous step, risk mitigation can save you a lot of headaches when dealing with multiple teams that work on different platforms. Be sure to dig deep into all the possibilities so that you know how to react if anything goes awry in any part of the process or once the product has been released to the public.

  1. Development steps

This part of the process usually starts from the get go and should be done before responsibilities are defined. However, its implementation starts only after the responsibilities and risks have been set and defined.

It will be described in more detail in the next phase of the project that is being presented here…

  1. Testing cycles

Knowing when to check on process components can be crucial in optimizing resources needed to complete such tasks. Spending too much time on functionalities that are not test-ready can be as time consuming as any unnecessary work.

By defining and revisiting these frameworks, the client and all the specialized teams can organize their efforts to achieve optimal productivity.

  1. Release procedures

When working on multiple platforms, you need to be aware of changes that are being released, which affect processes throughout applications. In addition, any publication has to be thoroughly planned so that there is a tightly defined process that all the teams can follow and adhere to.

Once you have these specifics in place, you will be ready to engage your respective development teams and engage in the final part of the process. Items that have been mentioned in this chapter (e.g., development steps, testing cycles and release procedures) will be described in more detail in the next chapter.

CRM integration with Magento

Develop what You Planned

You can finally start with the implementation after the groundwork has been set. To complete it you will need to use REST or SOAP API’s for both Magento and Salesforce CRM. In determining which areas of the applications to fetch, and which ways, you will need to consult API descriptions and documentations on both ends:

Salesforce API descriptions and documentations:

https://developer.salesforce.com/page/Salesforce_APIs

Magento API descriptions:

http://www.magentocommerce.com/api/soap/introduction.html

http://devdocs.magento.com/guides/m1x/api/rest/introduction.html

http://devdocs.magento.com/guides/v2.0/get-started/bk-get-started-api.html

As you may have noticed while browsing through those documents, both Magento and Salesforce CRM offer REST and SOAP API access; Magento offers lower and higher version API’s.
Let’s start with the second point. To distinguish which version of the Magento API to use, simply look at your installed Magento version. Since Magento 2.0 is currently only catching a head of steam, and all the functionalities need to be confirmed and adopted by the community, we will focus on the lower than 2.0 API documentation.

The first point is the best practice question when talking about programming practices in general. Based on our experiences and requirements the best advice I can give you is pretty straightforward and that is to use REST. There are multiple reasons. Overall (understanding the documentation, creating and using clients, development) simplicity; using of HTTP for communication, openness to multiple encoding formats (best practice is to use JSON); caching; and speed and scalability are the most important reasons for using REST.

SOAP still has its upsides in messaging and enterprise security, mostly in offline environments,  but those aren’t really factors and implementations that we will be looking for.

Once you have armed yourself with plans, technologies and tech teams, it is time to address the items you need to complete the integration. All of those can be listed based on the list of requirements we listed in the previous chapter and transforming those into development steps.

Steps we have used for requirements presented and that will be described here are:

  • Setting up the DEV environments
  • Setting up Salesforce API access
  • Fetching and updating price books and connected items
  • Placing orders and sending order data, along with payment details
  • Handling tax tasks
  • Sending order assigned media
  • Aligning coupons and custom coupon procedures

Although these steps don’t describe a full integration that concerns registered users, you will definitely get a clear picture about how to integrate core functionalities from one environment to another.

  1. Setting up the DEV environments

Test environments in Salesforce CRM, as in many other systems, are called “sandboxes”. In order to create a test app, where you will test everything you build, please refer to:

https://help.salesforce.com/apex/HTViewHelpDoc?id=data_sandbox_create.htm

When it comes to Magento, you will need a server instance that will operate as a DEV server. To do so, your development team will need access to a hosting account’s administration dashboard with the hosting and domain provider of your choice. They will then have to set up Magento there:

http://devdocs.magento.com/guides/m1x/install/installing.html

Once both environments have been set up you can proceed to setting up the API endpoints.

  1. Setting up Salesforce API access

To enable access to your Salesforce CRM sandbox, you will have to provide some information to the Magento development team that can be integrated into the API on their end.

First, create a username (usually e-mail address will do) and password. Once this is done, the team will go through a process of creating the authentication (access) token for API access. Upon completion, the Magento development team should be given that data.

Note: Please be sure that when you are creating the API user, you assign credentials to a group of users that has API access enabled or the access will not work no matter how much the other team tries.

Once the Magento team is given the data they will initiate the API with the address of the sandbox, credentials and the authentication (access) token to be able to send the data back and forth to Salesforce CRM.

  1. Fetching and updating pricebooks and connected items

Now we come to the first project task. Porting pricebooks and any product related items from Salesforce CRM to Magento.

The data that needs to be ported in our case had multiple layers (business case):

Each ZIP code area has a defined number of technicians being able to perform a number of category of tasks. Each category contained a number of services/products. We had to fetch ZIP codes, assign them to categories through their connection with a technician skill set, and then assign products/services to categories.

To achieve this functionality, our Magento API had to send a specially defined query in SOQL  (Salesforce Object Query Language) that would reference objects, their parameters and connections.

In our case, it was Technicians as a group of contacts, Technician ZIP codes and Technican skills for creating the dependency to services/products (those are fetched with a different SOQL call that specifies a parameter that has been flagged for e-commerce usage).

Another way to do it, is to call a custom Salesforce procedure/service (using a URL with the name of the procedure in it) that would then execute a predefined series of tasks and return the wanted results. Example URL for something like that would be:

https://sandbox_name.salesforce.com/services/apexrest/service_name/

SOQL is a language similar to SQL, and while it has most of its functionalities, it does work under some restrictions:

https://developer.salesforce.com/docs/atlas.en-us.soql_sosl.meta/soql_sosl/

Once results for that data are fetched, cross-referenced they are saved as Categories and Products depending on ZIP codes to Magento. In accordance with the client, this data was refreshed once a week by setting up a script that runs as a cron job and populates the data.

  1. Handling tax tasks

 In our use case both Magento and Salesforce CRM are using a Oracle powered database of ZIP/City relations as a tax reference. Both Magento and Salesforce CRM are using the REST API of the said DB to fetch service and sales tax of the location the user is in. We do so by sending the City and ZIP code provided by the user. The tax API returns the tax percentages for each category. The call is first made in to Magento and added to the order, and  confirmed later in Salesforce CRM once the order has been saved. 

  1. Placing orders and sending order data, along with payment details

 Once the order is defined by the user in Magento, be it a guest user that has entered their data (our use case) or a registered user that has entered their data on registration, we proceed with sending the data over to a layer of Salesforce API that processes the data. If everything is properly structured, the data saves to an opportunity. The process can be seen in the following flow chart:

 

Salesforce and Magento integration

The data is being sent in predefined JSON objects through the API, which then processes those fields, and saves them accordingly. After the order has been properly saved as an opportunity, the Salesforce CRM service returns some unique data for further usage.

The payment on this particular project has been handled with PayPal payment gateway. The transaction (pre-authorization only in this case) is processed once the user enters their payment data in the page. PayPal payment ID is then used as one of the parameters in the JSON field sent from Magento to Salesforce CRM, so that Salesforce CRM, which is connected to the client PayPal account, can have the said ID checked once the order is processed.

Once you are configuring the PayPal data in Magento admin, and if you pick PayPal payment gateway as your option, be sure to be aware of the fact that only PayPal Payflow Pro offers full API authorization while the other options require a redirect to PayPal:

Paypal flow

It is absolutely essential to validate fields on both ends to minimize any chance of errors in Salesforce CRM once the requests have been sent. After the data is received and validated in Salesforce and an opportunity is created, the response is sent back to Magento to handle a couple of items.

Next, we need to confirm success and complete the order, as well as handle media propagation from Magento to Salesforce CRM. 

  1. Sending order assigned media

In our use case the user is able to upload images that should be assigned to the case that is later on created in Salesforce CRM. Since encoding those and sending them directly through the API across several platforms can be a real hassle, we have opted for a different multi-faceted solution.

Once the Magento API receives the response from Salesforce CRm with the said opportunity/case number we opted to create a custom e-mail that has the following uses and functionalities:

  • Order confirmation PDF and mail body is sent to the user and to a mail address that is assigned to be pushed to Salesforce CRM automatically
  • Properly formatted opportunity/case ID is put in the bottom of the mail so that Salesforce CRM can attach it as a message to the right case thread
  • If the user responds to the mail and/or adds more media any response will also be attached to the case
  • If the Salesforce CRM administrator or client sales division responds to the message, a mail will be sent to the client in the same thread
  • A separate mail with uploaded images is sent to Salesforce CRM only, and is also identified by the same ID. We do it separately to prevent spamming the customer with their own media, and to split the media item in multiple messages if one message surpasses the size limit set in Salesforce CRM.

As you can see, this step is very important in keeping the communication open between customer service and the customer. By applying some simple logic, we are able to handle something that would cause some serious headache if being handled through the API only.

  1. Aligning coupons and custom coupon procedures

 Order placement and processing, that has already been covered, has one more facet that is interesting to explore.

Coupon codes can be added to Magento orders and defined in Salesforce CRM as well. In the use case that is mentioned, each were aligned manually in both systems and then applied to the order as a percentage field. Once a coupon code is received and processed in Salesforce CRM the only additional thing done is a price check after identification.

However, in the real world, coupon codes can give the customer more than just a simple discount. In our case, coupon codes provided customers with a gift card on a partner platform once the order and service are completed.

To be able to handle that kind of data properly, the coupon is defined as a specifically configured product in Salesforce CRM and saved as a coupon in Magento based on a custom parameter. Magento treats the data as a coupon and presents it in that format to the user; once the data is sent to Salesforce CRM a new product is used. 

  1. Test and release procedures

After you have finished all the tasks, be sure to include all of your structure in QA procedures:

  • QA teams for both Magento and Salesforce CRM
  • People that will be working as customer service on either end, so they can learn how to use functionalities and guide customers through the process
  • Rekindle communication between all the teams, so that issues can be addressed on both ends as soon as possible and each team understands what is expected of them

Once you have confirmed that your DEV and sandbox environments are stable and bug-free, it is time to show the results of your hard work to the world. Remember it is crucial to align both teams properly and release instances live, so that the first user that comes into your e-commerce store can use all of its features. If you wouldn’t open your brick and mortar store without products, cash register or sales personnel you should not open your e-commerce without all the layers set in the right order.

Summary

In the end, the most important thing is to keep your data in line and your customers happy and returning to your Magento store. As previously mentioned, integrating a couple of systems with such high complexity is not a completely straightforward task that would be done the same way for each of your Salesforce CRM to Magento connections.

Each requirement can be developed in a different manner, keeping in mind that the goal should be simplicity and scalability. Don’t be afraid to explore possibilities and open new avenues just because one of the stated methods works for a part of your app. Be bold and it will pay off in the long run. Both platforms give you a lot of wiggle room, and you should be able to find what works for you the best once you dig into the options.

If you are having issues or need more details on any of the methods or tools you could use, we’ll be happy to share our experience, lend a helping hand, or add our shovel to your digging effort – go ahead and contact us!

Tomislav is Farshore Software Architect who takes care of all phases of the project, from gathering requirements, digging into client businesses and tech needs and in the end delivering well rounded products directly to their “doorstep”.
He Holds a Masters Degree in Information Sciences from the University of Zagreb. When his computer screen shuts down he’s an avid NFL fan and a explorer of anything related to pop-culture, movies, books and history.
Did you find this article interesting? Share it on Social Media :
Share