When listing expert collaborators in Monocl for CRM you can add listed experts as records in your CRM. The base functionality includes a flow template that creates Lead records for Salesforce and Person accounts for Veeva, but this template can be copied and customized for your business requirements. For example, in Salesforce you might want to create Contacts and Accounts instead of Leads or create an Opportunity or Campaign Member every time an expert is added from Monocl. In this chapter we will show you how this can be done. Some knowledge of Salesforce Flow Builder is needed to create your own custom Flows but even if you are new to building Flows you should be able to follow along and get an idea of the possibilities. If you need help creating advanced custom flows Monocl Professional Services are available. If you want to learn more about building flows check out the Cloud Flow Designer guide.

Using the included flow

By default Monocl for CRM uses the included flow template newExpertLead. From a user perspective this flow appears as an integrated part of the Monocl workspace. 

To start the flow choose the menu icon to the right of an expert collaborator and select  "Add as Lead option". 

The flow appears within the Monocl workspace and values for first name, last name, company and email are prepopulated from the selected expert. You can change the values and when you click "Next" a new Lead is created. The screen is then changed back to the main expert overview.

However, note the new Lead icon to the left of the menu icon. This indicates that the expert is an existing Lead connected to Monocl. If you convert the Lead to a Contact the icon will change to a Contact icon. This gives you a quick overview of which experts' collaborators are already in your CRM.

How the default flow works

As a user the flow appears as an integrated part of the Monocl workspace and there is no need for the user to have any knowledge of how this works, or even that it is a flow. But as an administrator, understanding the design of the flow is the starting point of being able to customize it. So let’s take a look at the newExpertLead flow. In the Setup menu, select Process Automation -> Flows to get a list of available flows. Click the Open link to the left of the newExpertLead and you will see the design in Flow Builder.

In the left pane you see the toolbox and to the right is the flow layout that consists of the following steps.

Start: Receives input from the calling component in the form of an Expert__c record.
New Expert Lead: Shows a screen with prefilled values from the input.
SaveLead: Takes the input from the screen and Creates a new Lead
Existing Expert: Checks whether the passed in Expert__c record already exists or if it is a new expert that needs to be created and branches accordingly.
Save Expert: If this is a new Expert__c then it is created.
Save Connection: Saves a connection linking the Lead record with the Expert__c record.

Clicking on one of the steps will show more details on the exact workings of that step. To understand the flow it is important to know the data model that Monocl uses to store expert information. The two main objects used are monocl__Expert__c and monocl__Expert_Connection__c (namespace monocl left out in the rest of the text). Expert__c contains basic data about an expert in Monocl and has the following fields:

Id: Salesforce id of the record.
ExpertId__c: A unique Id identifying the expert.
Name: Full name (first and last name)
FirstName__c: First name.
LastName__c: Last name.
Email__c: Email address
PrimaryOrganization__c: Main company, university or other organization for the expert.

Each Expert__c record can be connected to multiple Salesforce Leads or Contacts. So even if you have five Leads and one Contact for an expert there will only be one Expert__c record. Which Leads and Contacts that are connected are saved in a Expert_Connection__c record that holds Lookup relationships to Lead, Contact and Expert__c. Note also that there is a trigger that handles Lead Conversion so that a Contact that is created through Lead conversion gets connected to the same Expert__c as the converted Lead. 

Customizing Lead creation, example 1

For this example, we are assuming that you have a requirement that says that when creating new Leads, they should always be rated as Hot, Warm or Cold. To modify the flow to handle this requirement open the flow in Flow Builder and click the Save As button to create a new Flow based on the template. 

When you click Save you will see a warning that this flow requires Lightning runtime. You can ignore this as Lightning is a requirement for using Monocl for Salesforce.

Then double click the New Expert Lead element and add a new Picklist to the screen from the Components on the Left. For choices you need to add a new set of choices based on the Lead picklist Ratings. When done your Edit Screen should look like below:

The next step is to configure the SaveLead step to include the selected rating when saving. To do this, enter the SaveLead step and add the Ratings field and the value from the Screen Component under the Set Field Values for the Lead heading. When you are done it should look like this.

Select done and save the Flow. Then click the "Back" link on the top right of the Screen and you will see the list of Flows. Click the name of your newly created custom flow and in the Flow Versions list click activate to make the flow available for use.

To configure Monocl for Salesforce to use your newly created Flow instead of the default template you need to use the Lightning App Builder and configure the Monocl Expert Overview Component for the Record Pages where you want to use the custom Flow. To do this on the Lead Page you can click the Edit Page button and select Monocl Expert Overview Component. In the right pane you will then see two input fields that allows you to change the Menu Label and the Flow Used. Input the API name for your custom Flow in the Add to CRM flow input field and save the changes.

You can select different flows for every record page used so if your organization have multiple page layouts for different record types or applications you could configure this so that for example marketing staff that uses the application gets a different flow than sales reps and so on. The option to change the Label in intended to be used if you create flows that not only creates Leads. So if you make create a flow that creates a Contact, Account, Opportunity and Campaign Member you can change the menu label to reflect this.

For the user the new custom Flow we just created will look like below:

This is a very simple example, but Flow Builder is a powerful tool that allows you to build much more complex flows without needing to have coding skills. Monocl will create a free reference library of sample flows so If you have created a smart flow that you would like to share with other Monocl for Salesforce users please feel free to share it with us so we can include it in the sample library.

Customizing Lead creation, example 2

In addition to the default newExpertLead flow template there is also another flow template NewRichExpertLead included with Monocl for Salesforce. This flow template works the same as the default flow and without any modification it does produce the exact same results. But instead of just accepting the Expert__c input it also does a callout to the Monocl API to get additional info about the expert. This makes it possible to use additional input from Monocl to customize your business processes.  

If you open this flow in Flow Builder it looks like:

The new step compared to the default flow is the getExpDetails, which is an Apex Action that takes an ExpertId as input, does a callout to the Monocl API and returns two Apex-Defined Variables, expert and primaryOrganization. In the getExpDetails flow step the ExpertId is taken from the passed in Expert__c record.

And the output is stored in the variables expertDetails and primaryOrg.

This means that after the Callout has been made additional info is available in these variables. Currently the following info is returned

primaryOrg: id, name
expertDetails id, name, firstName, lastName, email, specialty, totalCollaborations

This is just a few new values compared to the passed in Expert__c. The new values are the organization id, the expert’s specialty and the total number of collaborations that expert has. For future releases of Monocl for Salesforce Monocl are planning to add more values about the expert based on customer feedback. But with the currently available functionality you could use the Organization id to avoid creating duplicate Account records in a flow that creates Contacts and Accounts or you can enhance the Lead creation with info about specialty and number of collaborations. 

The following example demonstrates how you can do such an enhancement of Lead creation. It assumes that you have a custom number field NoOfCollaborations__c on Lead and that you want to add the specialty to the Description field. 

Just like the previous example start by opening the NewRichExpertLead flow and save it with the Name CustomRichLeadFlow. Then click the SaveLead step and add two new field Values for the save so that it looks like:

Save and activate the Flow. Then open up the Lightning App Builder for a record page and change the used flow to CustomRichLeadFlow. Then, when the users are creating the Lead, information about specialty and number of collaborations will be saved on the Lead. 

The Apex Action in this example can also be used when you want to create a separate flow that should do some automation based on expert data. For example you could build an automation that loops through all members of a Campaign or all Opportunity Contacts and selects the ones with most Collaborations or with a specific specialty.

Did this answer your question?