Skip to content

Service Match Setup Documentation

szeitz edited this page Feb 3, 2021 · 10 revisions

The following Wiki page will walk new Service Match users through important steps to setup and customize their Service Match.

Setup

UI Setup

To use the custom Lightning component, activate myDomain in your Salesforce org.. For more information, see Set Up My Domain.

The ReferralRecommendations page contains the Lightning component. Or you can add the component to a Contact page that you use in other apps.

  1. In Lightning App Builder, open your contact page. Drag the custom component to the page.
  2. Drag a flow component to the page and set it to the Client Profile Builder flow, and then use the checkbox to pass in the contactID as the recordId for the flow.
  3. Add the Birthdate field to the Contact Page Layout if you haven’t already.

Message Setup

Configuring an Email Service for the Client Recommendations Inbound Email Handler

Create the Email Service

From Setup, enter Email Services in the Quick Find box. Select Email Services and select 'New Email Service'.

  1. Enter a name in the 'Email Service Name' field. The example uses Client Referral Email Service
  2. In the 'Apex Class' field, type RecommendationsInboundEmailHandler
  3. Check the 'Activate' box
  4. Select 'Save and New Email Address'

Create a New Email Address

  1. In 'Email Address Name' and 'Email Address' you can enter the name of your choice.
  2. Check the 'Active' box to activate the email address.
  3. In the 'Context User' field, select a user that has System Administrator privileges. This user will be the owner of any record created by the inbound email handler. Note: Create a special context user so that it doesn’t become inactive.
  4. Select 'Save'

  1. In the 'Email Addresses' section, copy the Email Address you just created. It will be a very long email address that begins with the Email Service Name you used. You'll be using this email address in the next section so you will want to paste it somewhere so you can easily access it.

Create Your Organization-Wide Email Address

After you create the Email Address, make it an Organization-Wide Email so that you can use this email address as the Reply-To email in messages to your clients. Match the name to your organization.

  1. From Setup, enter Organization-Wide Addresses in the Quick Find box. In the 'Organization-Wide Email Addresses' section, select Add.
  2. Enter a Display Name to appear as the Sender for system-sent emails. This is what will appear when someone receives an email from you so you may want to include something specific to your organization.
  3. In the 'Email Address' field, paste the email address you copied from the last step.
  4. Select the profiles that you want to use this address. Make sure to include the Context User profile.
  5. Select Save

Confirm the Organization-Wide Email Address

To activate the Organization-Wide email, first validate the email address.

When the Email Service handler code receives a request to validate the email address, it creates a Task. This Task is assigned to the Context User that you specified when you created the Email Address.

  1. Log in as the Context User and navigate to the Home tab, where you can view the Tasks assigned to this user.
  2. For Lightning users, ensure that the Task List is set to show My Tasks

  1. To open the special Task, click Confirm Organization-Wide Email Address

  1. The task Comments contain the text of the verification email and a link to confirm the Organization-Wide Email Address. Click the link or copy and paste it into a browser to confirm the address.

After you click the link or enter it into a browser, you see a message that the email is verified.

Configure the Email in the Custom Metadata Type Record

From Setup, enter Custom Metadata Types in the Quick Find box. Click the 'Manage Records' link for the Referral Recommendations.

  1. Edit the Organization Default record, then enter the email service’s email address into the Recommendations Email Service Address field.
  2. Select Save

Schedule Batch Jobs

To send referrals and referral followup messages to clients, schedule two batch jobs.

  • Batch_SendInitialClientReferrals
  • Batch_SendReferralFollowupReminders

To schedule the batch classes to execute at least once daily, see Salesforce Help,Schedule Apex Jobs.

Suggested names for the jobs are:

  • Initial Referral
  • Referral Followup

You can schedule batch classes or you can run them at any time using the Execute Anonymous function in Salesforce. See Salesforce Help for more information: Executing Anonymous Apex Code

To execute the initial referral batch job, execute the following code snippet: refrec.Batch_SendInitialClientReferrals batchable = new refrec.Batch_SendInitialClientReferrals(); Database.executeBatch(batchable);

To execute the referral followup batch job, execute the following code snippet: refrec.Batch_SendReferralFollowupReminders batchable = new refrec.Batch_SendReferralFollowupReminders(); Database.executeBatch(batchable);

Data Setup

To import provider and service records, you can use an aggregator account with a supported aggregator or you can create records manually.


Custom Metadata

From Setup, search for Custom Metadata Types in the Quick Find box. Select Manage Records on the Referral Recommendations Setting.

Edit the Organizational Defaults and set your default latitude/longitude , your maximum distance, and email address.

To use a tool to find coordinates for your default address, see: Latitude and Longitude Finder on Map Get Coordinates.


Account

Create one or more accounts to represent providers


Services

In the refrec__Service__c object, add one or more Services that the Provider provides and fill out all the information. Be sure to populate its location fields (lat/long) with values close to where you sample contact is located

On the related tab, also add its operating hours.


Contact

Create a contact to represent someone you want to create a referral for. Their geolocation (uses the Other Address field by default) and age needs to match the service to be able to see it.