Webapp 2 Salesforce iCare Integration (CPC)

Introduction

The integration between Webapp and Salesforce iCare aims to provide Webapp users with information about campaign products (CPCs) visible to a given Customer Service Representative (CSR) and ensure that unavailable CPCs in Salesforce are not used.

Goals

  • Securely provide CPC visibility information to Webapp users.
  • Prevent the use of non-available CPCs in Salesforce.

Constraints

Enterprise Constraints

  • The solution must be secure, ensuring only authorized personnel can view their CPCs.

Business Constraints

  • Define a list of users or an algorithm for accessing the Webapp interface.

Technology Constraints

  • API call limits in Salesforce must be considered, implementing a caching mechanism within Webapp.

Integration Flow: OAuth 2.0 Web Server Flow

  1. A WEBAPP user clicks the “REFRESH CPCs” button.
  2. The connected app sends an authorization code request to the Salesforce authorization endpoint.
  3. Users are redirected to the Salesforce login page. Upon successful login, users approve the app’s access to order status data.
  4. Salesforce sends a callback to the WEBAPP with an authorization code after approval.
  5. The WEBAPP passes this code to the Salesforce token endpoint to request an access token.
  6. Salesforce validates the code and sends back an access token with permissions (scopes).
  7. The WEBAPP app requests CPC data from Salesforce using the access token.
  8. Salesforce validates the token and scopes.
  9. The WEBAPP app accesses the protected data, retrieving CPCs.

Webservice Exposing CPC to Webapp

Technology

  • REST/JSON

Method

  • GET

Details

  • Class Name: PP_WebappCPCS
  • URL: Webapp_CPCS
  • Call Parameters: None (response based solely on user context)
  • Connected App Name (Label & API): WebappCPCS

Example Response

{
  "EMAIL": "bartosz.borowiec-ext@solvay.com",
  "IS_SUCCESS": true,
  "ERROR_MESSAGE": "",
  "CPCS": [
    {
      "CAMPAIGN_NAME": "CP1",
      "WEBAPP_CPC_ID": "12423",
      "CPC_NAME": "123443243",
      "CPC_PRODUCT_CODE": "",
      "CPC_SOLDTO_CODE": "",
      "CREATED_DATE": ""
    },
    {
      "CAMPAIGN_NAME": "CP2",
      "WEBAPP_CPC_ID": "12425",
      "CPC_NAME": "123443243",
      "CPC_PRODUCT_CODE": "",
      "CPC_SOLDTO_CODE": "",
      "CREATED_DATE": ""
    }
  ]
}

Field Mapping

SF FieldJSON Field
User.EmailEMAIL
List of Pricing_Campaign_CPC__c wrappersCPCS
Pricing_Campaign_CPC__r.CreatedDateCREATED_DATE
Pricing_Campaign_CPC__r.Pricing_Campaing__r. NameCAMPAIGN_NAME
Pricing_Campaign_CPC__r. NameCPC_NAME
Pricing_Campaign_CPC__r. Product_code__cCPC_PRODUCT_CODE
Pricing_Campaign_CPC__r. Sold_To_Code__cCPC_SOLDTO_CODE
Indicates if the action was a success or notIS_SUCCESS
Error messageERROR_MESSAGE
Pricing_Camnaing_CPC__r.PP_WebappCPCID__cWEBAPP_CPC_ID

CPC Filtering

Only CPCs from campaigns that are active (Campaign End Date > Today) are sent to Webapp.

Access Determination to Interface

  1. The business provides a user list. These users will receive the PP_WebappIntegration permission set, enabling access to the PP_WebappCPCS class.
  2. The Webapp interface access to PP_WebappCPCS will be added to the profiles:
    • System Administrator
    • System Admin (Lite)
    • Sales User Lightning (No delete)
    • Management User Lightning (No delete)
    • GBU Data Steward
    • CSR User Lightning
    • ADL User Lightning
    • Agent User Lightning
    • B2BMA Integration User
    • and more...

New Field: Pricing_Campaing_CPC__r.PP_WebappID__c

  • Type: TEXT
  • Max Length: 255
  • Is Unique: No
  • Is External Id: No
  • Accessible To: Admin, System Admin (Lite) profile, Pricing Campaign Access - permission set.
  • No labels