SalesForce is a well-known CRM system that does a really good job of helping companies manage relationships with their consumers. It does this by storing consumer information as Contact records. In contrast, FACEOFFERS is an API and App Store-based platform for managing personal offers. FACEOFFERS works with the Contact information that is stored in CRM systems like SalesForce. In order to accelerate development and integration into other platforms, the FACEOFFERS team will be doing some of the development work. We will then rely on other developers to build their own applications and integrate with other systems. They can then sell their creations in the FACEOFFERS App Store.
Since SalesForce is so widely used, we decided this was one of the first integrations to work on. Although we aren’t finished with the entire integration work as of this writing, this post will show you how to use Microsoft Azure Logic Apps and API Apps in order to easily export new or recently edited contact information from a SalesForce Contact table. As any developer will tell you, being able to easily pull information from a 3rd party database in an automated and scalable fashion is half the solution. Any developer will also tell you that there are lots of different ways to accomplish the same goal when it comes to building applications. Here is one method. This process only takes about 20 minutes.
When your Logic App has been completed, you will have 4 cards that look like this.
Here is a video announcing the FACEOFFERS Salesforce integration work. I created this for Austin BUILD 2015.
– Microsoft Azure account (manage.windowsazure.com | portal.azure.com)
– SalesForce account or SalesForce Developer Account (www.salesforce.com | developer.salesforce.com)
Here is some information on the SalesForce Contact fields. (Salesforce fields) starts on page 30
Step 1) Create a SalesForce Connected App
In this step, you will need to create a SalesForce Connected App. The app will provide you with your OAuth Consumer Key and Consumer Secret. You will also set your Callback URL, which you will get from the SalesForce API app that you will create in Step 4. You will then use the Consumer Key and Consumer Secret in Step 4. This is all for the OAuth dance.
<IMAGE>
<IMAGE>
<IMAGE>
<IMAGE>
This image shows the Consumer Key, Consumer Secret and the Callback URL.
Step 2) Create a new formula field in the SalesForce Contact table
In this step, you will create a new formula field called New Contact. This field will keep track of new Contacts that are added and when Contacts are edited. When the Logic App runs, it will then only grab new Contacts and Contacts that have been edited since the last run. This step is necessary in order to use a simple SOQL query in step 6. Here is the formula shown in the screens shots.
if((now()- LastModifiedDate)>1,1,0)
<IMAGE>
<IMAGE>
<IMAGE>
<IMAGE>
<IMAGE>
This image shows where the formula is inserted. It also shows that the syntax is correct.
<IMAGE>
<IMAGE>
<IMAGE>
This image shows the NewContact__c field.
Step 3) Create the SalesForce API App connector in Microsoft Azure
In this step, you will create the SalesForce API app connector. This is a point and click operation. See the images below.
<IMAGE>
<IMAGE>
Step 4) Configure the SalesForce API App connector in Microsoft Azure
In this step, you will configure the SalesForce API app connector. You will need the Consumer Key and Consumer Secret Key to complete this step. See the images below.
<IMAGE>
<IMAGE>
This image shows the Consumer Key and Consumer Secret. It also shows the Callback URL.
Step 5) Create the SalesForce Logic App in Microsoft Azure
In this step, you will create the SalesForce Logic App. This is a point and click operation. See the images below.
<IMAGE>
<IMAGE>
Step 6) Configure the SalesForce Logic App in Microsoft Azure
In this step, you are going to drag the Recurrence API App and the SalesForce API App onto the canvass. Schedule the Recurrence API App to run once an hour. Next, click on the SalesForce Connector and select Execute Query. Here is the query that you will enter. Notice the NewContact__c field that you created in Step 2.
Select Id, FirstName, LastName, MobilePhone, Email, LastModifiedDate from Contact where NewContact__c = 0
OR (include address information)
Select Id, FirstName, LastName, MailingStreet, MailingCity, MailingState, MailingPostalCode, MailingCountry, MobilePhone, Email, LastModifiedDate from Contact where NewContact__c = 0
OR (include contact photo)
Select Id, FirstName, LastName, MailingStreet, MailingCity, MailingState, MailingPostalCode, MailingCountry, MobilePhone, Email, PhotoUrl, LastModifiedDate from Contact where NewContact__c = 0
<IMAGE>
<IMAGE>
<IMAGE>
This image shows how to configure the Logic App.
Step 7) Run the SalesForce Logic App and test
You can click Run Now to immediately test the Logic App. If the Logic App is working correctly, you will see a 1 next to successful under Runs today. You can then click on the hyperlinked text under Runs today for more information.
<IMAGE>
<IMAGE>
<IMAGE>
<IMAGE>
<IMAGE>
This image shows the JSON results from the Logic App.
That’s it. If you have set the interval to 1 hour, the Logic App will run every hour on the hour. It will retrieve both new contact records and recently edited contact records from your SalesForce organization.
In the next blog post on this topic, we will create additional API Apps that we can add as steps in our Logic App to complete the solution set. That’s all for now. Good luck!
Click here for Part 2. http://www.faceoffers.com/faceoffers-integration-with-salesforce-using-microsoft-azure-logic-apps-and-api-apps-part-2/