Syncplicity and Salesforce integration

The objective of this exercise is to build a flow that sends a link for a quote file in Syncplicity to a primary customer contact when the sales opportunity reaches negotiation/review stage in Salesforce. This integration occurs by doing the following in Integration Builder:

  • Configure connector instances for Salesforce and Syncplicity.
  • Define a flow to send a quote file to a primary customer contact.

Complete the prerequisites before you begin. In addition:

  • Set up at least one Salesforce opportunity for testing. The opportunity must have a primary contact with your email address so you can receive the link for the shared Syncplicity file. The opportunity can have any status but negotiation/review. Changing the status to negotiation/review is the trigger that launches the flow. You change the status when testing near the end of the exercise.
  • Prepare a test file in your Syncplicity folder. This can be, for example, a text file, Word document or PDF. You need the relative path of the file. For example, if the file path is Syncplicity/folder/test.pdf, the relative path to use is /folder/test.pdf.

Time to complete: 30 minutes

When completing fields in Integration Builder, make sure there aren't any spaces preceding values. Leading spaces are invalid.

Create an instance of Salesforce connector

Use this procedure to create an instance of a Salesforce connector in Integration Builder. 

  1. Select Connectors in the left pane.
  2. Find the Salesforce Sales Cloud connector. You can search for it by typing all or part of the connector name in the search field.
  3. Place the cursor over the Salesforce Sales Cloud tile and click Authenticate.
  4. Type a name for the connector instance. For example, Salesforce s2s exercise.
  5. Under Event Configuration:
    • Click the toggle to turn on Events Enabled.
    • Select polling as the Event Type.
    • Under Objects to Monitor for Changes, select opportunities and deselect all other options.
    • Scroll down to Event poller refresh interval (mins). Click and hold to slide the value to 1 minute.
  6. Click Create Instance. You are prompted to log on to Salesforce.
  7. Enter your Salesforce credentials to log on.
  8. Click Allow when prompted to allow access. You are returned to Integration Builder.

Create an instance of Syncplicity connector

Use this procedure to create an instance of a Syncplicity connector in Integration Builder. You can watch a video of this task.

  1. Select Connectors in the left pane.
  2. Find the Syncplicity connector. You can search for it by typing all or part of the connector name in the search field.
  3. Place the cursor over the Syncplicity connector tile and click Authenticate.
  4. Type a name for the connector instance. For example, Syncplicity s2s exercise.
  5. Make sure the Authentication Type is set to oauth2.
  6. Type the email address for your Syncplicity account in the Syncplicity User Email field.
  7. Do this step only if your Syncplicity account is in the European privacy region. See Prerequisites if you don't know or need to get the API key or secret.
    • Click Show Optional Fields.
    • Type your API key in the Syncplicity OAuth API Key field.
    • Type your secret in the Syncplicity OAuth API Secret field.
  8. Click Create Instance. You are prompted to log on to Syncplicity.
  9. Enter your Syncplicity credentials to log on.
  10. Click Grant access when prompted to allow access. You are returned to Integration Builder.

Add a flow in Integration Builder (part 1 of 8)

Once you have added the instances of the Salesforce and Syncplicity connectors in the preceding steps, perform the following steps to create a flow.

There are 8 parts to creating the flow. Complete all in order. After each part is displayed a graphic to show the progress of building the flow in stages.

  1. Select Flows in the left pane.
  2. Click Build New Flow Template. Options for adding flows are displayed.
  3. Click Build New Flow.
  4. Type a name for the flow when prompted. For example, s2s exercise.
  5. Click Create. You are prompted to select the type of trigger that will start the flow.
  6. Click Add Event in the Event tile. An Edit Event: "trigger" pane is displayed on the right.
  7. Type ${config.salesforce} when prompted for a connector instance variable.
  8. Click Save. A flow diagram like the following is displayed. You add to this flow in later steps.

Add the flow variables (part 2 of 8)

Add variables to use in the flow. The following table describes the three variables needed. Refer to the table when adding the variables.

Variable name Type Description
salesforce Connector instance Salesforce uses to subscribe to opportunities updates
syncplicity Connector instance Syncplicity uses to share a link to download a file
filePath Value The path of the file to download

The following are the steps for adding a variable.

  1. With the exercise flow open, click Variables at top right. A Flow Variables pane is displayed on the right.
  2. Click Create New Variable if not already selected.
  3. Click the correct type for the variable you are adding.
  4. Type the variable name when prompted.
  5. Click Save .
  6. Repeat until all three variables have been added.

Query the opportunity information (part 3 of 8)

  1. In the flow editor, click + below the trigger step to add a step.
  2. On the Create New tab, click Connector API Request.
  3. Complete the following fields and click Save.
    • Name: getOpportunityInfo
    • Connector Instance Variable: ${config.salesforce}
    • Method: GET
    • API: /opportunities/${trigger.event.objectId}

Check whether the opportunity is at negotiation stage (part 4 of 8)

Use this procedure to add on success and on failure steps.

On success

  1. In the flow editor, click the getOpportunityInfo step and then click ADD ONSUCCESS.
  2. On the Create New tab, click JS Filter (true/false).
  3.  Complete the following fields and click Save.
  4. Type a name for the step in the Name field. For example, isNegotiation.
  5. Copy and paste the following JavaScript.
done(steps.getOpportunityInfo.response.body.StageName == 'Negotiation/Review')

On failure

  1. In the flow editor, click the isNegotiation step and then click ADD ONFAILURE.
  2. Click JS Script.
  3. Complete the following fields and click Save.
  4. Type a name for the step in the Name field. For example, ignore.
  5. Copy and paste the following JavaScript.
done("Opportunity not in Negotiation")

Retrieve the opportunity contact email (part 5 of 8)

Use this procedure to add a flow step that uses Salesforce Object Query Language (SOQL) to query the contact email.

  1. In the flow editor, click the isNegotiation step and then click ADD ONSUCCESS.
  2. Click JS Script.
  3. Complete the following fields and click Save.
    • Type a name for the step in the Name field. For example, prepareQueryPath.
    • Copy and paste the following JavaScript.

var path = `SELECT Contact.Email, Contact.Name FROM OpportunityContactRole WHERE IsPrimary = TRUE and opportunityId = '${trigger.event.objectId}'`
done(path.replace(/ /g, '+'))

Add opportunity contact (6 of 8)

Use this procedure to add the opportunity contact.

  1. In the flow editor, click the prepareQueryPath step and then click ADD ONSUCCESS.
  2. Click Connector API Request.
  3. Complete the following fields and click Save.
    • Name: getOpportunityContact
    • Connector Instance Variable: ${config.salesforce}
    • Method: GET
    • API: /query/?q=${steps.prepareQueryPath}

Create a link to enable the lead contact to download the file (part 7 of 8)

Use this procedure to use Syncplicity to share a link to a file with the contact email retrieved from the previous step.

  1. In the flow editor, click the getOpportunityContact step and then click ADD ONSUCCESS.
  2. Click JS Script.
  3. Complete the following fields and click Save.
    • Type a name for the step in the Name field. For example, constructBody.
    • Copy and paste the following JavaScript.
SharedLinkBody = {};
SharedLinkBody.ShareType = "2";
SharedLinkBody.ShareSyncplicityLinkPolicy = "3";
SharedLinkBody.Users = [];
SharedLinkBody.Users.push({});
SharedLinkBody.Users[0]["EmailAddress"] = steps.getOpportunityContact.response.body[0].Contact.Email; 
done(SharedLinkBody);

Use this procedure to add a step for sharing the file link.

  1. In the flow editor, click the constructBody step and then click ADD ONSUCCESS.
  2. Click Connector API Request.
  3. Complete the following fields and click Save.
    • Name: shareLink
    • Connector Instance Variable: ${config.syncplicity}
    • Method: POST
    • API: /files/links?path=${config.filePath}
    • Under SHOW ADVANCED, Body:  ${steps.constructBody}

Create an instance of the flow

Once the flow has been completed, perform the following steps.

Think of the flow you created as a template. Using the flow requires creating an instance of the flow template.

  1. Click Flows in the left pane to open the page that shows all flows.
  2. Find the s2s exercise flow. You can search for it by typing all or part of the flow name in the search field.
  3. Place the cursor over the s2s exercise tile and click  Create Instance. Three variables tiles are displayed. These are the variables you created earlier.
    • salesforce
    • syncplicity
    • filePath
  4. Type a name for the flow instance. For example, Salesforce to Syncplicity.
  5. In the salesforce tile click  +  to select a connector instance. Click Salesforce s2s exercise.
  6. In the syncplicity tile click  +  to select a connector instance. Click  Syncplicity s2s exercise.
  7. In the Values tile for filePath type the relative path of the Syncplicity file to share. For example, /myDirectory/FileName.pdf.
  8. Click  Create Instance.
Any time you want to verify the presence of the instances of connectors or flows you have added, click   Instances on the left pane. Click   Connector or   Flow at the top to show lists of connectors or flows instances.

Test

Once all configuration has been completed, perform the following steps to test whether Syncplicity shares a link with the primary contact of an opportunity when it's updated to the negotiation/review stage in Salesforce.

  1. In Salesforce, choose any opportunity. Change the primary contact's email so that you can receive emails.
  2. Update the opportunity to the negotiation/review stage.
  3. Check whether your configured email receives a shared link from Syncplicity. This might take a few minutes.

  4. Follow the link in the email to download the file.

You can monitor the flow execution in Integration Builder.

  1. Click Instances in the left pane.
  2. Click Flow.
  3. Find the flow instance in the list and click Executions.
  4. Click an object ID tile to reveal execution step tiles.
  5. Click a step tile to show details.

Related Links