Creating Opportunities from Referrals


In order to disable the Accept & Create new Opportunity from Incoming Referral or Create new Opportunity from Incoming Referral without accepting or Create new Opportunity from Referral flows, you need to flip the feature toggle. It is a hierarchy custom setting, meaning it has three layers of applicability in descending priority:

  1. Applied to a specific user, if configured (user level).
  2. If not, then applied to all users under the same profile, if configured (profile level).
  3. If not, then applied to all users in the organization (org level).

This means that you can create an elaborate hierarchical structure of allowing some but not all of your users to create Opportunities from incoming Referrals. For example, you can keep the feature enabled for the whole org by default, but then disable it for all the users of a specific profile, but then enable it for some specific users of that same profile.

OOTB, the feature is enabled for the whole org (3rd layer in the list above).

If you want to change that, go to Setup > Custom Settings and click Manage next to “WorkSpan Settings.”

This is how it looks OOTB:

If you see something different—it means your settings have been changed since the installation. Depending on which level you want to set up, click on the New button (if it’s available) at the top (org level) or the bottom (profile and user level) of the page.

If some setup already exists, then you can edit or delete them.

For the org-level setup, you only need to check the box next to Opportunities from Incoming Referrals if you want to enable the flow or uncheck it to disable it. Click Save.

For the profile or user level, you are also required to specify the profile or the user to whom it applies.

1. Map default field values when creating Opportunities from Referrals

What happens when a user clicks on the Create Opportunity or Accept & Create button in one of the use cases is that we launch the “Populate new Opportunity fields from Referral” (PnOffR) Flow in the background. This Flow stores a mapping of field values from a Referral to an Opportunity, extracts those values from the current Referral record, and propagates them into a standard “New Opportunity” modal as default values. The user is then free to change any of those values and decide how the Opportunity will look. However, if you have enabled the Flow Templates to keep Referral and Opportunity in sync, then the final field values will be defined in those, and any user input and default mappings will be overwritten.
The PnOffR Flow is an Invokable one, meaning it doesn’t work on its own; it needs to be called from another Flow, Process, or code. It is very simple; the main part is the “Set Opportunity fields” assignment node.

OOTB, provides the following mapping:

Source Referral field Target Opportunity field
Referral Name Opportunity Name
Close Date Close Date
Sales Stage Stage
Description Description
Next Step Next Step

Here’s how you can modify the PnOffR Flow to create Opportunities with specific record types pre-selected without your users needing to select them manually.

  1. Click on the New Resource (1), select Resource Type = ‘Variable’ (2), enter some API Name (3), select Data Type = ‘Text’ (4), and click Done (5).

  1. Insert a new “Get Records” node right after the start element.

  1. Type in some Label (1), some API Name (2), select Object = ‘Record Type’ (3), Field = ‘DeveloperName’ (4), Value = your desired Opportunity’s Record Type developer name (‘WorkSpan_Opportunity’ in my example) (5), then scroll down.

  1. Select Choose fields and assign variables (advanced) (6), In separate variables (7), Field = ‘Id’ (8), Variable = the variable that you created in p.1 (9), and click Done (10).

  1. Double-click on the ‘Set Opportunity fields’ assignment node and click Add Assignment.

  1. Select Variable = ‘{!Opportunity.RecordTypeId}’ (1), Value = the variable that you created in p.1 (2), and click Done.

  1. Click Save As (1), enter some Flow Label (2), some API Name (3), a Description to make life easier for yourself and your fellow admins (4), and click Save (5).

  1. Click Activate.

The Flow will be saved as a new one, leaving the original PnOffR Flow hanging in the background, seemingly useless. However, you should NOT deactivate that original Flow because the package relies on it to find your new one.
  1. Now your users will also have this Record Type already selected (without the ability to change it) whenever they use the Create Opportunity feature.

You can invoke this same Flow in other use cases. For example, you can:

  • Invoke the Flow on the ‘create Referral’ trigger to auto-create an Opportunity as soon as new Incoming Referral land in Salesforce.
  • Invoke the Flow on the ‘update Referral’ trigger to auto-create an Opportunity after an Incoming Referral is accepted.
0 out of 0 found this helpful



Article is closed for comments.