Sync Salesforce Accounts with Shopify Customers

Sync Salesforce Accounts with Shopify Customers

Use this recipe to synchronize Salesforce accounts with customer records in Shopify.

Note: This recipe is available as Salesforce — Shopify | Sync Accounts and Customers in the Integration Store. Oracle provides this recipe as a sample only. The recipe is meant only for guidance, and is not warranted to be error-free. No support is provided for this recipe.

Overview

This is a bidirectional, application-driven recipe. It creates or updates a corresponding customer record in Shopify when an account record is created or updated in Salesforce. Similarly, it creates or updates a corresponding account record in Salesforce when a customer record is created or updated in Shopify.

To use the recipe, you must install the recipe package and configure the connections and other resources within the package.

When an account is created or updated in Salesforce, the Oracle Salesforce Shopify Account To Customer Sync integration flow of the recipe is triggered, and it creates or updates a corresponding customer record in Shopify. Similarly, when a customer record is created in Shopify, the Oracle Shopify Salesforce Customer To Acc Create integration flow of the recipe is triggered, and it creates a corresponding account in Salesforce. Further, when Shopify customer records are updated, the Oracle Shopify Salesforce Customer To Acc Update integration flow is triggered, which propagates the updates to corresponding Salesforce account records. Basic data, such as name, email, note, phone, and address, are synchronized between the Salesforce and Shopify platforms.

System and Access Requirements

Before You Install the Recipe

You must perform the following configuration tasks on your Salesforce and Shopify instances in order to successfully connect to these external systems using Oracle Integration and synchronize records between them.

Configure Salesforce

To access Salesforce from Oracle Integration and create or read account records, you must perform certain configurations on your Salesforce instance.

You must create a user account on Salesforce for Oracle Integration. You’ll use the credentials of this user account while configuring the Salesforce connection in Oracle Integration.

Also, identify your Salesforce instance type and your current Salesforce API version. In addition, create an outbound message to trigger the Oracle Salesforce Shopify Account To Customer Sync integration flow of the recipe, and create a workflow rule to send the outbound message when a Salesforce account is created. Finally, you must create a custom field for Salesforce account records to store Shopify customer IDs.

Log in to your Salesforce instance as an Administrator and execute the following tasks.

Note: The steps provided here apply to the Salesforce Classic UI. If you’re using the Lightning Experience UI on your Salesforce instance, switch to the Classic UI.

  1. Create an API-enabled custom role. You’ll assign this role to the user account you’ll subsequently create for Oracle Integration.

    1. On the Salesforce Setup page:

      1. Expand Manage Users under the Administer section in the left navigation pane.

      2. Click Profiles.

    2. On the Profiles page, click New Profile.

    3. On the resulting page:

      1. Select Standard User in the Existing Profile field.

      2. Enter a name for the new profile, for example, API Enabled, and click Save.

      The new profile is now saved, and the Profile Detail page of the new profile is displayed.

    4. Click Edit on the Profile Detail page.

    5. On the Profile Edit page:

      1. Scroll to the Administrative Permissions section and ensure that the API Enabled check box is selected.

      2. Scroll to the Standard Object Permissions section and perform the following actions.

        • In the Accounts row, leave the Read box checked. Additionally, select the CreateEdit, and Delete check boxes.
      3. Scroll to the end of the page and click Save.

  2. Create a user account for Oracle Integration and assign the custom role created previously to this account.

    Note: If you have already created a user account for Oracle Integration, you can assign the API-enabled custom role to the existing account.

    1. On the Profile Detail page of the API Enabled profile, click View Users.

    2. Click New User in the resulting page.

    3. On the New User page:

      1. Enter a first name and last name for the user, for example, Integration User05.

      2. In the Email field, enter a valid email address.
        The email address you enter is automatically populated in the Username field. Note this username.

      3. In the User License field, select Salesforce.

      4. In the Profile field, select the profile you created previously, that is, API Enabled.

      5. Scroll to the end of the page, ensure that the Generate new password and notify user immediately check box is selected, and click Save.
        The user account is now created, and a verification email is sent to the email address you provided for the account.

    4. Log in to the corresponding email account and click the Verify Account button in the email message from Salesforce.
      You’re redirected to the Salesforce instance to set a password for the new user account.

    5. Set a password and note the same.
      Subsequently, you’re signed in to the Salesforce instance with the new account.

      Note: If you’re shown the Lighting Experience UI, switch to the Salesforce Classic UI.

    6. Generate a security token for the new user account. You’ll need this security token along with the password to access Salesforce using Oracle Integration.

      1. Stay signed in as the new user and click the user name at the top of the page to open a menu.

      2. Click My Settings in the menu.

      3. On the My Settings page, in the Quick Links section, click Edit my personal information.

      4. On the resulting page, click Reset My Security Token in the left navigation pane.

      5. Click the Reset Security Token button.
        A new security token is sent to the email address associated with the account. Note the security token.

      6. On the Salesforce instance, click the user name again and select Logout from the menu. Log back in as the Administrator.

  3. Identify your current Salesforce API version. See Find Your Current Salesforce API Version.

  4. Identify your Salesforce instance type. See Identify Instance Type of Your Salesforce Organization.

  5. On your Salesforce instance, create an outbound message to trigger the Oracle Salesforce Shopify Account To Customer Sync integration flow of this recipe.

    1. On the Salesforce Setup page:

      1. Scroll to the Build section in the left navigation pane.

      2. Expand Create, then Workflow & Approvals, and then click Outbound Messages.

      If you’re shown the Understanding Workflow page, click Continue.

    2. Click New Outbound Message in the resulting page.

    3. On the New Outbound Message page:

      1. Select Account in the Object field, and click Next.

      2. Enter the following details for the new outbound message:

        • Enter a name for the outbound message. Note that the Unique Name field is automatically populated based on the name you enter.

        • Optionally, enter a description for the message.

        • In the Endpoint URL field, enter the following URL:
          https://<OIC_FQDN:OIC_SSL_PORT>/ic/ws/integration/v1/flows/salesforce/ORCL-R-SFDC_ACC_SYN_TO_SHOPY_CUS/1.0/

          Where OIC_FQDN and OIC_SSL_PORT are the fully-qualified domain name and port of your Oracle Integration instance (for example, oicinstance.example.com:443).

        • In the User to send as field, select the user account using which you want to send the message.

        • Under Account fields to send, select all the fields and click Add.

        • Click Save.

    The new outbound message is created and displayed on your browser.

  6. Now, create a workflow rule to send the outbound message (created previously) when a Salesforce account is created or updated.

    1. On the Salesforce Setup page:

      1. Scroll to the Build section in the left navigation pane.

      2. Expand Create, then Workflow & Approvals, and then click Outbound Messages.

      If you’re shown the Understanding Workflow page, click Continue.

    2. Click New Rule in the resulting page.

    3. On the New Workflow Rule page:

      1. Select Account in the Object field, and click Next.

      2. Enter the following details for the new workflow rule:

        • Enter the rule’s name.

        • Optionally, enter a description for the rule.

        • In the Evaluation Criteria section, select the created, and every time it’s edited radio button.

        • In the Rule Criteria section, select the formula evaluates to true option, and define the following rule criteria:
          (Account: Account Name STARTS WITH Shop) AND (Account: ShopifyCustomer_id EQUALS null)

        • Click Save & Next.

      3. On the next page, click the Add Workflow Action button and choose Select Existing Action.

      4. On the Select Existing Actions page:

        • Select Outbound Message in the Search field.

        • In the Available Actions box, select the outbound message you created previously, for example, Outbound Message: <name of your outbound message>.

        • Click Add to move your selection to the Selected Actions box.

        • Click Save.

      5. Click Done.

      The new workflow rule is created and displayed on your browser.

    4. Click Activate to activate the rule.

  7. Create a custom field for account records.
    This recipe uses unique IDs associated with customer records in Shopify to synchronize Shopify customers with Salesforce accounts. Create a custom field for Salesforce account records to hold the Shopify IDs.

    1. On the Salesforce Setup page:

      1. Scroll to the Build section in the left navigation pane.

      2. Expand Customize, then Accounts, and then click Fields.

    2. On the Account Fields page, scroll to the Account Custom Fields & Relationships section and click New.

    3. On the New Custom Field page:

      1. Find and select the Text radio button, and click Next.

      2. Enter the following details for the new custom field:

        • Enter ShopifyCustomer_id as the field label. Note that the field name is automatically populated based on the label you enter.

        • Enter 50 as the length.

        • Optionally, enter a description for the new field.

        • Select the External ID check box.

        • Click Next.

      3. On the Establish field-level security page, select the Visible check box in the header row to grant edit access to the new field for all profiles. Click Next.

      4. Leave all the layout check boxes selected and click Save.

    On the Account Fields page, you can see the new field added under the Account Custom Fields & Relationships section.

Configure Shopify

To configure Shopify, see Prerequisites for Creating a Connection.

Install and Configure the Recipe

On your Oracle Integration instance, install the recipe package to deploy and configure the integration flows and associated resources.

  1. On the Oracle Integration home page, scroll to the Accelerators & Recipes section.

  2. Click Search All.

  3. Find the recipe package that you want to install.

  4. Select the package, and then click the Install Install icon icon.

  5. After the package is installed, click the Configure Configure icon icon on the recipe card to configure the resources deployed by the package.

    The Configuration Editor page opens, displaying all the resources of the recipe package. Configure the following resources before you activate and run the recipe.

Configure the Oracle Salesforce Connection

  1. On the Configuration Editor page, select Oracle Salesforce Connection, then click Edit Edit icon.
    The connection configuration page appears.

  2. In the Connection Properties section, enter the following details.

    Field Information to Enter
    Select Salesforce.com Instance Type Select Production, Sandbox, or Government based on your Salesforce instance type.
    API Version Enter your current Salesforce API version. To obtain the API version, see  Configure Salesforce.
  3. In the Security section, enter the following details.

    Field Information to Enter
    Security Policy Leave Salesforce Username Password Policy selected.
    Username Enter the username of the account created for Oracle Integration on Salesforce. See Configure Salesforce.
    Password

    Enter the password of the account created for Oracle Integration on Salesforce. See Configure Salesforce.

    Note: To the password, you must also append the security token generated for the same account.

  4. Click Save. If prompted, click Save for a second time.

  5. Click Test to ensure that your connection is successfully configured. In the resulting dialog, click Test again.
    A confirmation message is displayed if your test is successful.

  6. Click Back Back icon to return to the Configuration Editor page. Click Save again if prompted.

Configure the Oracle Shopify Connection

  1. On the Configuration Editor page, select Oracle Shopify Connection.

  2. Click Edit Edit icon.
    The connection configuration page appears.

  3. In the Connection Properties section, enter the following details.

    Field Information to Enter
    Host Name Enter the Shopify host name that appears in the Shopify home URL. For example: https://hostname.myshopify.com
    Shopify REST API Version
    Enter the REST API version.
  4. In the Security section, enter the following details.

    Field Information to Enter
    Security Policy Leave Shopify Security Policy selected.
    Username Enter API key obtained earlier. See Configure Shopify.
    Password Enter password obtained earlier.
    Shared secret Enter shared secret obtained earlier.
  5. Click Save. If prompted, click Save for a second time.

  6. Click Test to ensure that your connection is successfully configured. In the resulting dialog, click Test again. A confirmation message is displayed if your test is successful.

  7. Click Back Back icon to return to the Configuration Editor page. Click Save again if prompted.

Update the Integration Property for the App-Driven Flow

Update the integration properties for the all the integration flows of this recipe package.

This integration flow contains the following property:

For the procedure to update the integration property, see Steps 7 to 9 in Override Design-Time Properties in an Integration.

Activate and Run the Recipe

After you’ve configured the connections and other resources, activate the recipe package and run it.

  1. On the Configuration Editor page, click Activate in the title bar. In the Activate Package dialog, click Activate again.
    A confirmation message is displayed informing that the integrations have been submitted for activation. Refresh the page to view the updated status of the integrations.

  2. Run the recipe to create or update Shopify customers for new or updated Salesforce account records.

    1. Log in to your Salesforce instance.

    2. On the Salesforce Setup page (in the Classic UI), click the Accounts tab.

    3. Create a new account.

      1. On the Accounts Home page, click New.

      2. On the New Account page, enter the account details, such as name, description, and so on, and ensure that the ShopifyCustomer_id field is blank. Click Save.

    4. Or, update an account.

      1. On the Accounts Home page, select All Accounts in the View field, and click Go!. All the accounts in your Salesforce instance are displayed.

      2. Click an account record to open it.

      3. On the account’s page, in the Account Detail section, click Edit. Further, scroll to the Notes & Attachments section, click New Note, enter a title and body message for the note, and click Save.

      You’ve now successfully triggered the recipe, which creates or updates a corresponding customer record in Shopify.

  3. Run the recipe to create or update accounts in Salesforce for Shopify customer records.

    1. Log in to the Shopify instance.

    2. On the left navigation pane, click Customers.

    3. Create a new customer record.

      1. In the Customers window, click Add Customer.

      2. Enter the following details.

        • First Name, Last Name, Email, Phone, and Address.
        • Select the Collect Tax check box if the customer is not tax exempted.
        • Add additional notes if necessary.
    4. Or, update an existing customer record.

      1. In the Customers window, select a customer record from the list of available records, and click Edit.

      2. Update the any detail of the customer record, and click Save.

    You have now successfully triggered the recipe, which creates or updates a corresponding account record in Salesforce.

  4. Monitor the execution of the integration flows in Oracle Integration.

    1. On the Configuration Editor page, select any of the two integration flows.

    2. Click Run Run icon, then click Track Instances.

    3. On the Track Instances page, you’ll see the integration flows of the recipe being triggered and executing successfully.
      The recipe synchronizes accounts in Salesforce with customer records in Shopify.

  5. Log in to your Shopify instance and check for the new or updated customer records.

    1. On the home page, select your Shopify store, for example, orcl-shop-connector-dev-store.

    2. On the store page, click Customers on the left navigation pane. The list of the customers is displayed, which contains the corresponding records for the accounts created or updated in Salesforce.

    3. To view a customer record’s details, click its name.

  6. Log in to your Salesforce instance and check for the new or updated account records.

    1. On the Salesforce Setup page (in the Classic UI), click the Accounts tab.

    2. On the Accounts Home page, select All Accounts in the View field. Click Go! if necessary.
      The list of accounts is displayed, which contains the corresponding records for the customers created or updated in Shopify.

    3. To view an account record, click its name.

Related Documentation