Sync Contacts Between Salesforce and Oracle B2C Service

Sync Contacts Between Salesforce and Oracle B2C Service

Use this recipe to synchronize contact records between Salesforce and Oracle B2C Service.

Note: This recipe is available as Salesforce — Oracle B2C Service | Sync Contacts 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 recipe creates a corresponding contact in Oracle B2C Service when a new contact record is created in Salesforce. After successful creation of contact, the Oracle B2C Service contact Id will be saved in the custom field of the Salesforce contact.

To use the recipe, you must install the recipe package and configure the connections and other resources within the package. When a Salesforce contact is created, the integration flow of the recipe is triggered via platform events configured in Salesforce, and it creates a corresponding contact record in Oracle B2C Service. Basic data such as first name, last name, address, and so on, are synchronized between the two platforms.

System and Access Requirements

Before You Install the Recipe

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

Configure Salesforce

To access Salesforce using Oracle Integration and retrieve data about Salesforce contacts that are created, 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.

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 ReadCreateEdit, and Delete boxes checked. Additionally, select the ViewAll check box.

        • In the Contacts row, leave the ReadCreateEdit, and Delete boxes checked. Additionally, select the ViewAll check box.

        • In the Price Books row, leave the Read box checked. Additionally, select the CreateEdit, and Delete check boxes.

        • In the Products 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. Create a custom field to store the Oracle B2C Service contact id.

    1. On the Salesforce Setup page:

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

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

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

    3. Select the Text radio button, and click Next.

    4. Enter the following details for the new custom field and click Next.

      Field Information to Enter
      Field Label Enter the field name. For example, RNContact_Id.
      Length Enter the maximum length for the text field. For example, 255.
      Field Name This field is automatically populated.
      Description Enter a description for the custom field.
    5. On the Establish field-level security page, select Visible and click Next.

    6. Leave all check boxes selected in the next page, and click Save.

  6. Configure the Salesforce platform event. The platform event notifies external systems about changes to the Salesforce contact records.

    1. In the left navigation pane of the Salesforce Setup page, scroll to the Build section, expand Develop and then click Platform Events.

    2. On the Platform Events page, click New Platform Event.

    3. On the New Platform Event page, enter the following information:

      Field Information to Enter
      Label Enter a label for the field. For example, ContactCreate_PE.
      Plural Enter the plural form of the label field.
      Object Name This field is automatically populated.
      Description If required, enter a description for the new platform event.
      Publish Behavior Select one of the following options:
      • Publish After Commit The event message is published only after a transaction commits successfully. Subsequently, the subscriber receives the event message after the data is committed. If the transaction fails, the event message isn’t published.
      • Publish Immediately The event message is published when the publish call executes, irrespective of whether the transaction succeeds or not. Subsequently, the subscriber receives the event message before the data is committed.
    4. In the Deployment Status section, select Deployed.

    5. Click Save.

  7. Create custom fields to store Oracle B2C Service contact record details.

    1. In the Custom Fields & Relationships section of the Platform Event page, click New.

    2. On the resultant New Custom Field page, select the Text radio button, and click Next.

    3. Enter the following details for the custom field:

      Field Information to Enter
      Field Label Enter the field name. For example, ContactId_PE.
      Field Name This field is automatically populated.
      Length Enter the maximum length of the text field. For example, 255.
      Description Enter a description for the custom field.
    4. Click Save.

    5. Create as many custom fields as required by repeating steps a-d. For example, you can create custom fields such as FirstName_PE, LastName_PE, MailingCity_PE, PostalCode_PE and so on.

  8. Create and activate a process that triggers the platform event.

    1. In the left navigation pane of the Salesforce Setup page, scroll to the Build section. Expand Create and then Workflow and Approvals, and click Process Builder.

    2. Create a process.

      1. On the Process Builder page, click New.

      2. Enter the following details in the New Process dialog:

        Field Information to Enter
        Process Name Enter a name for the process.
        API Name This field is automatically populated.
        Description If required, enter a description for the process.
        The process starts when Select A record changes.
      3. Click Save.

    3. Configure the process trigger.

      1. Click the Add Object in the process flowchart.

      2. From the Choose Object and Specify When to Start the Process pane that opens, select the following and click Save.

        Field Information to Enter
        Object Select Contact.
        Start the process Select When a record is created or edited.
    4. Add the process criteria. You can specify the criteria that must be true for the process to execute associated actions.

      1. Click Add Criteria in the decision box.

      2. In the Define Criteria for this Action Group pane that opens, provide the following information.

        Field Information to Enter
        Criteria Name Enter a name for the criteria.
        Criteria for Executing Actions Select Conditions are met.
      3. Create a condition to restrict the integration user from triggering the process.

        Field Information to Enter
        Field Search for Contact.FirstName and select it.
        Operator Select Is null.
        Type Select Boolean.
        Value Select False.
      4. Create another condition to restrict the integration user from triggering the process.

        Field Information to Enter
        Field Search for Contact.LastName and select it.
        Operator Select Is null.
        Type Select Boolean.
        Value Select False.
      5. From the Conditions options list, select All of the conditions are met (AND).

      6. Expand the Advanced drop-down list, and for Do you want to execute the actions only when specified changes are made to the record? select Yes.

    5. Add action to the process.

      1. In the Immediate Actions box beside the TRUE arrow, click Add Action. Enter a name for the action. For example, CreateContact_Trigger.

      2. In the Create a Record pane, under Record Type, select the Platform event that you created earlier in step 6.

      3. In the Set Field Values section, create rows for all the custom fields that you created earlier in step 7.

        To create a row for a custom field:

        • Under Fields, type the name of the custom field.

        • Under Type, select Field Reference.

        • Under Value, select the corresponding value of the custom field.

        Repeat the above steps to create rows for all the custom fields.

      4. Click Save.

    6. Activate the process.

      1. On the top right of the Process Builder page, click Activate.

      2. In the Activate Version dialog, click Confirm.

Configure Oracle B2C Service

To access Oracle B2C Service using Oracle Integration and create corresponding contact records for Salesforce contacts, you must login to your Oracle B2C Service as an Administrator and complete certain prerequisite tasks. 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 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 or Sandbox 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.

    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 B2C Service Connection

  1. On the Configuration Editor page, select Oracle Service Cloud (RightNow) Connection.

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

  3. In the Connection Properties section, specify the WSDL to use. See Prerequisites for Creating a Connection.

  4. In the Security section, enter the username and password that you obtained. See Prerequisites for Creating a Connection.
    Note that only the Username Password Token security policy is supported.

  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.

Activate and Run the Recipe

After you’ve configured the connections, 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 integration has been submitted for activation. Refresh the page to view the updated status of the integration.

  2. Run the recipe. To run the recipe, you must create a contact in Salesforce.

    1. Log in to your Salesforce instance.

    2. On the Salesforce Setup page, click the Contacts tab.

    3. On the Contacts Home page, click New.

    4. On the New Contact page, enter the contact details such as first name, last name, address, and so on, and then click Save.

    You’ve now successfully triggered the recipe by creating a contact in Salesforce.

  3. Monitor the execution of the integration flow in Oracle Integration.

    1. On the Configuration Editor page, select the integration flow.

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

    3. On the Track Instances page, you’ll see the integration flow of the recipe being triggered and executing successfully.

    The recipe now creates a corresponding contact in Oracle B2C Service for the new contact created in Salesforce.

  4. Check for the corresponding new contact created in Oracle B2C Service.

    1. Log in to your Oracle B2C Service instance.

    2. Search for the new contact created.

    3. Open the contact and check if the basic data matches that of the new contact created in Salesforce, and the Oracle B2C Service contact id got updated in the custom field (RNContact_Id).

Related Documentation