Accelerator Salesforce Customers System API - Implementation Template
Prerequisites
This implementation template has the following dependencies:
- Create Custom fields and provide permissions for the Service Account User
- Enable Record types
- Security token for service account user in Salesforce
- Connected App in Salesforce
Custom fields
The following fields must be created in the corresponding objects.
Salesforce Object | Field Label | Field Name | Data Type | Length | Unique* | ExternalId |
---|---|---|---|---|---|---|
Account | Global Billing Address ID | Global_BillingAddress_Id | Text | 36 | Y | Y |
Account | Global Customer ID | Global_Customer_Id | Text | 36 | Y | Y |
Account | Global Email Address ID | Global_EmailAddress_Id | Text | 36 | Y | Y |
Account | Global Fax Number ID | Global_FaxNumber_Id | Text | 36 | Y | Y |
Account | Global Mailing Address ID | Global_MailingAddress_Id | Text | 36 | Y | Y |
Account | Global Mobile Number ID | Global_MobileNumber_Id | Text | 36 | Y | Y |
Account | Global Party ID | Global_Party_Id | Text | 36 | Y | Y |
Account | Global Phone Number ID | Global_PhoneNumber_Id | Text | 36 | Y | Y |
Account | Global Shipping Address ID | Global_ShippingAddress_Id | Text | 36 | Y | Y |
Account | Customer Status | Customer_Status | Picklist | - | N | N |
Contact | Global Email Address ID | Global_EmailAddress_Id | Text | 36 | Y | Y |
Contact | Global Individual ID | Global_Individual_Id | Text | 36 | Y | Y |
Contact | Global Phone Number ID | Global_PhoneNumber_Id | Text | 36 | Y | Y |
Contact | Global Mobile Number ID | Global_MobileNumber_Id | Text | 36 | Y | Y |
Contact | Global Other Address ID | Global_OtherAddress_Id | Text | 36 | Y | Y |
Contact | Global Mailing Address ID | Global_MailingAddress_Id | Text | 36 | Y | Y |
Opportunity | ACH Transfer Authorization Document ID | Ach_Transfer_Auth_Document_Id | Text | 36 | N | N |
Opportunity | Asset Transfer Authorization Document ID | Asset_Transfer_Auth_Document_Id | Text | 36 | N | N |
Opportunity | Document Signatures Received | Document_Signatures_Received | Checkbox | - | - | - |
Opportunity | KYC Completed | KYC_Completed | Checkbox | - | - | - |
*Unique fields should be case-sensitive
Create via Apex script
An Apex class called CustomFieldUtility
can be used to create custom fields programmatically. The source for this class can be found in the Common Resources project. Download this project and follow the steps below.
- Click on Salesforce Setup icon and select
Developer Console
to open a new console window - Go to
File -> New -> Apex class
and create a new class namedCustomFieldUtility
- Copy the code from
accelerator-common-resources/salesforce/CustomFieldUtility.apxc
to the script editor - Select the
File -> Save
menu option to compile and save the class - Select
Debug -> Open Execute Anonymous Window
- Copy and paste the contents of
accelerator-common-resources/salesforce/CreateCustomFields.txt
into the window. - Enable the
Open Log
option and click the Execute button.
Once the script completes, select the Debug Only
filter option to show just the results of each create request. Verify that all fields have been successfully created.
Create manually via Salesforce
To create each of these custom fields and enable visibility for them on page layouts:
- Click the Salesforce Setup icon.
- Select the
Object Manager
tab from the Setup home page. - Find and select the target Salesforce object.
- Select the
Fields & Relationships
page. - Click the New button and create the field as specified above.
- Repeat these steps for each custom field in the above list.
Enable the Custom fields for the Service Account User
- Click the Salesforce Setup icon.
- Select the
Object Manager
tab from the Setup home page. - Find and select the target Salesforce object.
- Select the
Fields & Relationships
page. - Select the field that requires the permission enabled.
- Click the
Set Field-Level Security
button. - Enable for desired profile, or tick the checkbox next to
Visible
to enable visibility for the desired profile(s).
Tip: Instead of adjusting permissions for each field as you go, if you are only making them available to one or two profiles it may be more efficient to go to the Users -> Profiles -> {profile} -> Object Settings
for each object and adjust the permissions for multiple fields at once.
Additional notes
- The Customer Status picklist values are Prospect, Onboarding, Active, Inactive, Closed, Deceased, Delinquent, and Dormant.
- All
Global_*_Id__c
fields should be visible in layouts (as described above) but made read-only to avoid issues with data synchronization.
Create or Enable Record Types
The following record types must exist in the corresponding objects for the accelerator assets to function correctly. These record types need to be created if they do not exist. If the Record Type already exists, ensure that it is enabled for the target profile of the Service Account User.
Salesforce Object | Record Type Label | Details |
---|---|---|
Account | Household | Record Type Name -> IndustriesHousehold |
Lead | Lead | Record Type Name -> Lead, Lead Process -> Sales Lead |
To create the Record Type, follow the instructions for each object below :
- Click the Setup gear icon, then click Setup.
- Search for the Salesforce Object. A page appears with Details of the Object.
- Click Record Types under the Details section to see the list of available Record Types on the Object. Click New.
- In the Existing Record Type field, select Master.
- Enter the Record Type Label, Record Type Name and other details from the
Details
Column and Enter a Description. - Select Active. Enable for all needed profiles. Click Next.
- Select Apply one layout to all profiles.
- From the Select Page Layout List, select a Layout and Click Save.
To enable the Record Type, follow the instructions for each object below :
- Click the Setup gear icon, then click Setup.
- Navigate to
Users -> Profiles
. - Select the target profile for the service account user.
- Navigate to Object Settings and select the Salesforce Object from the above table and click the Edit button.
- Under
Record Types and Page Layout Assignments
check the record type. - Click the Save button.
Configure Connected App for authentication
Follow the below steps to generate the Consumer Key
and Consumer Secret
values required for Salesforce authentication.
- Click the Salesforce Setup icon.
- Navigate to
Apps -> App Manager
. - Select
New Connected App
. - Enter Connected App Name:
MuleSoft Accelerator
, API Name:MuleSoft_Accelerator
and set your email address. - In the
API (Enable OAuth Settings)
section, check the boxEnable OAuth Settings
. - Set the callback URL
http://localhost
. - From the
Selected OAuth Scopes
list, selectFull access (full)
. - Click Save and then Continue.
- Click the Manage button to view details for the new connected app.
- Click the Edit Policies button.
- In the
OAuth Policies
section, forPermitted Users
selectAll users may self-authorize
. - For
IP Relaxation
, select theRelax IP restrictions
option. - Click Save.
You now need to copy the Consumer Key
and Consumer Secret
values for use in configuring Mule application deployments. More specifically, these must be supplied as the values for the sfdc.fsc.client-id
and sfdc.fsc.client-secret
properties found in the FSC-BANKING-DEV
, FSC-Insurance-DEV
and FSC-WEALTH-DEV
profiles in your Maven settings.xml
file.
- On the Setup Home page, navigate to
Apps -> App Manager
. - Locate your new connected app and choose
View
from the actions dropdown for that item (last column on the right). - Under the
API (Enable OAuth Settings)
section, click the Manage Consumer Details button. - Verify your identity by entering the verification code that was emailed to you.
- Copy the key and secret values and update your
settings.xml
file as described above.
Download the Common Resources project for a sample settings.xml
file that can be used as a starting point.
Generating security token for service account
A token needs to be generated for the service account used by the Mule applications in order to connect to the FSC instance.
- Login to Salesforce as the Service Account User (the account that will be used by the Mule applications for connecting to Salesforce).
- Click the Username icon in the top right corner and select
Settings
from the menu. - Select
My Personal Information -> Reset My Security Token
(if not found, see note below). - Click Reset Security Token.
- Check the email inbox for an email from Salesforce with the new security token.
Note: If the option to reset your security token is not available, it is likely that one or more Login IP Ranges are in effect. These can be temporarily removed from the settings page of the profile assigned to the service account user.
Next steps
The Deployment tab provides instructions on how to properly configure the application for running locally from Studio or deploying to CloudHub.