Reading Time: 8 minutes

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.

latest report
Learn why we are the Leaders in API management and iPaaS

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.

INFO  2018-02-21 17:03:07,033 [[MuleRuntime].cpuLight.08: [salesforce-trigger].salesforce-triggerFlow.CPU_LITE @5378bfeb] [event: 0-229ecf20-176c-11e8-89f0-a45e60eede9d] org.mule.runtime.core.internal.processor.LoggerMessageProcessor: {LastModifiedDate=2018-02-22T01:02:59.000Z, Company=MuleSoft, Email=null, Address={country=United States, city=San Francisco, countryCode=null, street=77 Geary St.
FL 400, latitude=null, postalCode=94108, geocodeAccuracy=null, stateCode=null, state=CA, longitude=null}, Latitude=null, ProductInterest__c=null, type=Lead, MobilePhone=null, Name=Nathan Nam, Industry=null, CreatedById=0051a000000aDICAA2, SICCode__c=null, Street=77 Geary St.
FL 400, DandbCompanyId=null, PhotoUrl=/services/images/photo/00Q1a00000kjqb3EAA, ConvertedOpportunityId=null, MasterRecordId=null, Status=Open - Not Contacted, IsDeleted=false, ConvertedAccountId=null, IsConverted=false, LastViewedDate=2018-02-22T01:03:00.000Z, City=San Francisco, Longitude=null, CleanStatus=Pending, LeadSource=null, GeocodeAccuracy=null, Primary__c=null, State=CA, CreatedDate=2018-02-22T01:02:59.000Z, Country=United States, Id=00Q1a00000kjqb3EAA, LastName=Nam, AnnualRevenue=null, Jigsaw=null, EmailBouncedDate=null, Description=null, ConvertedDate=null, Rating=null, PostalCode=94108, Website=null, LastReferencedDate=2018-02-22T01:03:00.000Z, NumberOfEmployees=null, CompanyDunsNumber=null, Salutation=null, ConvertedContactId=null, OwnerId=0051a000000aDICAA2, Phone=null, NumberofLocations__c=null, EmailBouncedReason=null, FirstName=Nathan, IsUnreadByOwner=false, Title=null, SystemModstamp=2018-02-22T01:02:59.000Z, CurrentGenerators__c=null, LastActivityDate=null, Fax=null, LastModifiedById=0051a000000aDICAA2, JigsawContactId=null}

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.