Get started with the Salesforce connector

The Salesforce Connector provides an API to work with Salesforce objects.

To use any connector, you first need to create a logic app. You can get started by creating a logic app now.

Connect to Salesforce connector

Before your logic app can access any service, you first need to create a connection to the service. A connection provides connectivity between a logic app and another service.

Create a connection to Salesforce connector

Prerequisites

Before you can use your Salesforce account in a logic app, you must authorize the logic app to connect to your Salesforce account.Fortunately, you can do this easily from within your logic app on the Azure Portal.

Here are the steps to authorize your logic app to connect to your Salesforce account:

  1. To create a connection to Salesforce, in the logic app designer, select Show Microsoft managed APIs in the drop down list then enter Salesforce in the search box. Select the trigger or action you'll like to use:
    Salesforce connection image 1
  2. If you haven't created any connections to Salesforce before, you'll get prompted to provide your Salesforce credentials. These credentials will be used to authorize your logic app to connect to, and access your Salesforce account's data:
    Salesforce connection image 2
  3. Provide your Salesforce user name and password to authorize your logic app:
    Salesforce connection image 3
  4. Allow us to connect to Salesforce:
    Salesforce connection image 4
  5. Notice the connection has been created and you are now free to proceed with the other steps in your logic app:
    Salesforce connection image 5

Use a Salesforce connector trigger

A trigger is an event that can be used to start the workflow defined in a logic app. Learn more about triggers.

In this walk-through, you will learn how to use the Salesforce - When an object is created trigger to initiate a logic app workflow when a new lead is created in your Salesforce.

Note

You will get prompted to sign in to your Salesforce account if you have not already created a connection to Salesforce.

  1. Enter salesforce in the search box on the logic apps designer then select the Salesforce - When an object is created trigger.
    Salesforce trigger image 1
  2. The When an object is created control is displayed.
    Salesforce trigger image 2
  3. Select the Object Type then select Lead from the list of objects. In this step you are indicating that you are creating a trigger that will notify your logic app whenever a new lead is created in Salesforce.
    Salesforce trigger image 3
  4. That's it. You've created the trigger. However, you need to create at least one action in order to make this a valid logic app.
    Salesforce trigger image 4

At this point, your logic app has been configured with a trigger that will begin a run of the other triggers and actions in the workflow when a new item is created in your Salesforce.

Add a condition

This condition will evaluate the email address field of each new Salesforce lead. If the email address contains amazon.com, the condition result will be True.

  1. Select + New step.
    Salesforce condition image 1
  2. Select Add a condition.
    Salesforce condition image 2
  3. Select Choose a value.
    Salesforce condition image 3
  4. Select the Email token from the lead of the trigger.
    Salesforce condition image 4
  5. Select Contains.
    Salesforce condition image 5
  6. Select Choose a value at the bottom of the control.
    Salesforce condition image 6
  7. Enter amazon.com as the value you would like to evaluate the email address of the new lead for. If the email address contains amazon.com, the condition will evaluate to True and the other steps in your logic app can proceed.
    Salesforce condition image 7
  8. Save your logic apps.

Use a Salesforce connector action

An action is an operation carried out by the workflow defined in a logic app. Learn more about actions.

Now that you have added a condition, its time to do something interesting with the data that's generated by the trigger. Follow these steps to add the Salesforce - Get object action. This action will get the data each time a new lead is created. You will also add a second action that will use the data from the Salesforce - Get an object action to send an email using the Office 365 connector.

To configure the this action, you will need to provide the following information. You will notice that it is easy to use data generated by the trigger as input for some of the properties for the new file:

Create file property Description
Object type This is the type of Salesforce object you are interested in. Examples are Lead, Account, etc.
Object ID This represents an identifier for the object.
  1. Select Add an action link. This opens the search box where you can search for any action you would like to take. For this example, Salesforce actions are of interest.
    Salesforce action image 1
  2. Enter salesforce to search for actions related to salesforce.
  3. Select Salesforce - Get object as the action to take. Note: you will be prompted to authorize your logic app to access your Salesforce account if you have not done so previously.
    Salesforce action image 2
  4. The Get object control opens.
  5. Select lead as the object type.
  6. Select the Object ID control.
  7. Select ... to expand the list of tokens that can be used as input for actions.
    Salesforce action image 3
  8. Select Lead ID control opens.
    Salesforce action image 4
  9. Notice that the Lead ID token is now in the Object ID control, indicating that the Get object action will search for a lead with an ID that is equal to the lead ID of lead that triggered this logic app.
    Salesforce action image 5
  10. Save your work. That's it, you have added the Get object action to your logic app. Your Get object control should look like this:
    Salesforce action image 6

Now that you have added an action to get a lead, you may want to do something interesting with the newly created lead. In an enterprise, you may want to send an email to notify a distribution list that a new lead has been created. Let's use the Office 365 connector to send an email with some of the relevant information from the new lead object in Salesforce.

  1. Select Add an action then enter email in the search control. This filters the actions to those that are related to sending and receiving email.
  2. Select the Office 365 Outlook - Send an email list item. If you haven't already created a connection to your Office 365 account, you will be prompted to enter your Office 365 credentials to create it now. After you are done, the Send an email control opens.
    Salesforce action image 7
  3. Enter the email address that you'd like to send email to in the To control.
  4. In the Subject control, enter New Lead created - then select the Company token. This will display the company field from the new lead created in Salesforce.
  5. In the body control, you can select any of the tokens from the new lead object and you can also enter whatever text you would like to display in the body of the email. Here's an example:
    Salesforce action image 8
  6. Save your workflow.

That's it. Your logic app is now complete.

Now, you can test your logic app: in Salesforce, create a new lead that meets the condition you created. If you followed this walk-through fully, just create a lead with an email address that contains amazon.com in it. After a few seconds your logic app should be triggered and the results may look similar to this:
Salesforce action image 9

Connector-specific details

View any triggers and actions defined in the swagger, and also see any limits in the connector details.

Next steps

Create a logic app