Introducing new triggers with the Salesforce Connector

February 28 2018

3 comments
salesforce connector

We are introducing new features and lots of improvements in Mule 4. In support of Mule 4, we are also focusing on improving user experience of the Salesforce Connector, one of the most popular SaaS applications. In this blog post, I will showcase a demo that provides insight into the new capabilities in the Salesforce Connector.

Let’s suppose you want to trigger your integration flow as soon as a new lead is created in Salesforce. You might want to notify your sales reps through email, Slack, or SMS, or you might want to update this lead record to other applications you have in your company. This entire process starts with how you get this new lead record from Salesforce.

You have multiple options to accomplish this use case. You can set up a topic, channel, or platform event to capture this new lead record with Streaming APIs supported by the Salesforce Connector. However, it would require additional settings (e.g. pulling new record through a Topic Channel) in your Salesforce instance to do so. Alternatively, you can use the Scheduler, the Object Store Connector, DataWeave, and the Salesforce Connector to accomplish this use case as well. In this case, your flow would look like the below:

You can also configure many granular options such as where to store the timestamp and using a specific Salesforce Object Query Language(SOQL); however, this would require you to learn how to use many different components other than the Salesforce Connector.

With the Salesforce Connector v9.1.0 for Mule 4, this process is reduced to its most simple form.  All you need to do is to drop a Salesforce Connector into your flow and assign a trigger. Let’s dig into what these triggers are.  

The latest version of the Salesforce Connector comes with three new triggers:

  1. New object
  2. Updated object
  3. Deleted object

The “New object” trigger will return a new record, such as a lead, an account, or an opportunity. The “Updated object” trigger will return an updated record. For example, if an email address is added or updated to your existing lead record, the trigger will return that record. The “Deleted object” trigger returns a deleted record which was moved to your Recycle Bin in Salesforce.

As the first step, let’s download the Salesforce Connector v9.1.0 from Anypoint Exchange in Anypoint Studio 7.

After you download the Salesforce Connector, look for “New Object” in the palette and drag and drop it into a Mule project. Once you add a logger, your flow would look like the below. (Please note that I configured Logger log the payload.)

Let’s configure the connector. To configure the Salesforce Connector, go to Global Elements, find “Salesforce Config” and then click “Edit.”

In the “Salesforce_Config,” you can specify the configuration for Salesforce. Please add your Salesforce credentials in the configuration.

Now, it is time to configure the “New object” trigger. Object Type shows available objects in your Salesforce instance. For this example, I selected “Lead.” You can specify the starting point in the “Since” field using the following format: YYYY-MM-DD hh:mm:ss (i.e. 2017-03-17 16:30:40). If you don’t put any value, the connector will automatically start to return a new object when you start the Mule app. You can also specify how often you want the connector to check new records in Salesforce.

 

After you start this Mule app, go to Salesforce to create a new lead record.

As soon as you save this record in Salesforce, you can check the following message in the Studio console. Please note that the content you will get might be different from the one below.

For new users, try the above example to get started, and for others, please share with us how you plan to use these new triggers with the Salesforce Connector!

Also, be sure to explore Anypoint Exchange to see other resources you can use today.


 


We'd love to hear your opinion on this post


3 Responses to “Introducing new triggers with the Salesforce Connector”

  1. Thanks for the great post. I had tried the streaming functionality with a previous version of mule and sf connector, but the connections were not consistent.
    Does this version resolve that issue?

    • I would also like to know.

      Thanks

      • Adarsh, Ben,

        Thanks for your comments. Could you be more specific what you meant by ” the connections were not consistent”?

        Thanks,
        Nathan