Automating Salesforce to Predictive Insights Integration

Options
AnaplanOEG
edited August 2023 in Best Practices

Introduction

Please note: the Salesforce connector for CloudWorks is currently in beta

The following document describes the steps needed to automate integration between Salesforce and Predictive Insights.

The overall flow described by this document can be depicted like this:

This flow will:

  1. Load a list of accounts and account data from Salesforce into Anaplan modules.
  2. Score and enrich the accounts using Predictive Insights.
  3. Write the updated account information to Salesforce.

The flow can be scheduled, to support periodic scoring and enrichment of the accounts.

For this procedure, we assume that the user is assigned the Integration Admin or Restricted Integration Admin role in Anaplan to configure CloudWorks. The user will also need to be assigned a Workspace Admin(1) role to access Predictive Insights.

(1) Predictive Insights role will be available in future.

Preliminary Steps

Salesforce connection

Connect your Anaplan instance to Salesforce as described here.

Anaplan modules and lists

Create a list for all the accounts that need to be scored and/or enriched. The list should contain names of the relevant accounts from your CRM.

For the purpose of this example, we have called this list “Accounts SFDC List for Scoring and Enrichment”.

Create Id property in the list to hold Salesforce Account IDs:

Create an import action that populates the “Accounts SFDC List for Scoring and Enrichment” with data. Use a sample CSV file with the following columns:

Name,Type,Website,Id

This format populates account name, account website, account SFDC ID and account type. You can add other fields based on the information you may want to pull from Salesforce. You need your import action template CSV headers to match standard Salesforce account field and property names. See this document for Account object reference.

  • Set default file to ‘Admin Only’ or ‘Everyone’

For the purpose of this example, call this import action “IMP Accounts SFDC List for Scoring and Enrichment”.

As a next step, a source module that contains account information and is dimensionalised by “Accounts SFDC Source List for Scoring and Enrichment” should be created. This module should also contain other relevant information, for example: Website, Is Customer, Type.

In the below example, we are leveraging “Account Type” CRM field and we automatically calculate the Is Customer field using a formula:

IF
    COMPARE(Type, "Customer - Channel") = 0 OR COMPARE(Type, "Customer - Direct") = 0
THEN
    TRUE
ELSE
    FALSE

You can do it differently, of course; this is provided as an example.

Using the same file as above, create an import action into the module. We have called this import action “IMP Account SFDC Data for Scoring and Enrichment”.

  • Set default file to ‘Admin Only’ or ‘Everyone’.
  • Map the account names as the main dimension.
  • Map the fields according to the line items in the module. Make sure to ignore unmapped fields.

Final preparation step is the creation of a module that will contain results of Predictive Insights scoring action. We have called this module “Account Scoring Module”. The module should be dimensionalised by “Accounts Source List for Scoring and Enrichment” list and should contain additional line items:

The Id line item refers to the Id property of the “Accounts Source List for Scoring and Enrichment” list.

Create export action to export the data from the module.

  • Omit summary items.
  • Omit empty rows.
  • Include Row label headers.
  • Save export action as “EXP Predictive Scores and Ranks”.
  • Set default file to ‘Admin Only’ or ‘Everyone’.

Predictive Insights Configuration

Create the following Predictive Insights objects. You may already have them in your system.

  1. Create a Predictive Insights dataset.
  2. If you plan to run both enrichment and scoring operations, create a Predictive Insights model using the dataset from the previous step.
    1. Create a Score accounts action.
    2. Create an Enrich accounts action.

Create a Helper Module for Enrichment Data

In Predictive Insights configuration section you have created an enrichment action and this action has automatically created a module with enrichment data.

The module needs to be a copy of the module generated by the enrichment action with an addition of one field, Id. That field should reference Account ID property from the list of accounts.

All other fields in the new module should refer to the appropriate fields in the original enrichment module. For example, this is the module generated by the enrichment action:

This is the helper module that was created to expose this data for Salesforce export:

Configuring CloudWorks Integrations

Bringing updated account information from Salesforce to Anaplan

  • Create an import integration in CloudWorks to populate the “Accounts Source List for Scoring and Enrichment” list.
  • Choose Import action type.
  • Choose Salesforce Account object as source of your data.
  • Use the import action, “IMP Accounts SFDC List for Scoring and Enrichment” that you created before.
  • Press ‘Next’
  • Note that Account ID and Account Name are mapped.
  • Create the integration.

  • Create another import integration in CloudWorks to populate the module with source account information that you created before.

Creation steps will be similar to those mentioned before. However, you need to use the import action “IMP Account SFDC Data for Scoring and Enrichment” that you created before.

  • Note that Account Name, Account Type and Website are mapped.
  • Create the integration.

Invoking Predictive Insights flows

  1. Create a Predictive Insights integration in CloudWorks to invoke account scoring.
  2. Create a Predictive Insights integration in CloudWorks to invoke account enrichment.

Run both integrations to verify their correct operation. You can run the integrations from CloudWorks → Integrations and Processes list.

Writing updated information from Anaplan to Salesforce

  • Locate the “EXP Predictive Scores and Ranks” action that you previously created.
  • Make sure that your Salesforce setup contains fields that will be able to hold scores and ranks that are exported from Anaplan (you may need your Salesforce admin/developer to create custom fields to store the score and rank).
  • Create an export integration in CloudWorks to export the predictive scores to Salesforce using the export action above. Map the unique identified field to be the Id field. Choose Upsert if you want to create or update existing account objects.
  • Create an export action from the account enrichment temp data module. This action will be used by CloudWorks to export the account enrichment information to Salesforce.
  • Make sure that your Salesforce setup contains fields that will be able to hold enrichment data that is exported from Anaplan (you may need your Salesforce admin/developer to create a custom field to store the enrichment information).
  • Create an export integration in CloudWorks to export the enrichment data to Salesforce using the export above. Map the unique identified field to be the Id field. Choose Upsert if you want to create or update existing account objects. Example of mapping:
  • Run both integrations to verify their correct operation. Inspect the results in Salesforce instance. You can run the integrations from CloudWorks à Integrations and Processes list.

Creating an End-to-End Integration Flow

You are now ready to create an end-to-end integration flow. This flow will include the following logical steps:

  1. Bring updated account data from Salesforce to Anaplan
  2. Run Predictive Insights enrichment and scoring of the updated accounts.
  3. Export the results to Salesforce.

The entire process can be packaged as a CloudWorks integration flow. This makes sure that all the steps are executed in the desired order. Integration flows can be scheduled to create a periodic scoring and enrichment process.

Make sure you have the following integrations ready in CloudWorks:

When creating an integration flow, you need to add integration steps in the correct order and to decide if you want to ‘Stop on Failure’ or ‘Stop on Partial Success’.

Your configured integration flow will look like this and you can now run or schedule it.