CPQ for Lightning Communities

by Community Manager on ‎06-12-2017 05:39 PM


Salesforce CPQ and the Salesforce Partner Community provide an online selling platform that connects your resellers and distributors to your own sales processes and resources, and allows your channel partners to service their buyers directly.


CPQ for Self-Service is a new way for our customers to connect with their own customers. Our clients can now extend the full power of CPQ functionality to a Customer Community, allowing their customers to self-service when they need to add-on products or licenses to an existing Contract or create a new Quote.   


We’ve enhanced Partner Communities to support this effort by extending our Theming Engine, allowing for different types of fieldsets to be used, and having the option to prevent users from creating new quotes from an amendment or add-on workflow.


Note: The Lightning CPQ Panel is no longer required in Lightning Communities.



Users should be familiar with the following features:



  1. Enabling customers to self-serve in a Lightning Community
  2. Create a Lightning Component to enable self-service add-ons and amendments in a Lightning Community  
  3. Setting up a Lightning Community
  4. Create a trigger to create an Opportunity when a quote is created in a Customer Community


You can configure Salesforce CPQ to enable your partners and customers to self-serve in a Partner or Customer Community.   All the business logic embedded into your CPQ application extends to the Community as well.  This means all configuration logic, pricing scenarios, volume or term discount schedules, contracted pricing and more are available to your partners and customers.  



  1. Ensure Communities is enabled on your org.  Contact your Salesforce Account Executive for more information.  
  2. Ensure that there is a SalesforceCPQ License Customer or Partner Community license assigned to your community users.
    1. Go to Setup->Installed Packages->Salesforce CPQ-> Manage Licenses
    2. Ensure that your customer user is Licensed and has the correct permissions

Create a Lightning Community

  1. Go to Setup > Communities > All Communities.  
  2. Select New Community.  
  3. Choose the Customer Service (Napili) template and follow the prompts, which take you to the Community Builder. Note:  You can choose from any template that is available to you, including installing a Lightning Bolt created by a Salesforce Partner. For this article, we'll use Salesforce’s standard Napili template. For more information, see Community Templates for Self-Service.

Enable CPQ in the Lightning Community

  1. Select the Navigation Menu.
  2. Add the Quote object to the Navigation Menu. Select Save Menu > Publish.  
  3. Select the Quotes tab.  You should see a list of Quotes.   


Use Case #1 - New Business Flow

You want to enable your customers to purchase net new products/place new orders in your Customer Community. After creating a Customer Lightning Community, follow these steps:

  1. Create a Global Action for New Quote if one does not exist.
    1. Go to Setup > User Interface > Global Actions > Global Actions
    2. Select New Action
    3. Enter the following field values, then select Save.
      1. Action Type: Create a Record
      2. Target Object: Quotes
      3. Label: New Quote
      4. Name: New Quote
    4. Drag and drop fields that you want your user to complete before they add new products, then select Save
  2. In the Community Builder, select Components > Records > Create a Record and drag it where you'd like. In this example, we're placing it below the Welcome message.
  3. Select the Create a Record widget and enter the following information:
    1. Button Label: Build a Quote (example)
    2. In the Global Actions section, select New Quote (the global action you made in Step 1)
    3. Select Save and close the widget


Your users can now enter into a New Business flow from the homepage of your Community.  


Triggers for Automatic Opportunity Generation

Quotes do not automatically generate Opportunities after creation.  To enable automatic Opportunity generation, make a trigger that creates an Opportunity once a customer community Quote has been saved.  


Trigger Example 


trigger AfterUpdateCreateOppty on SBQQ__Quote__c (after update) {
   for(SBQQ__Quote__c q : trigger.new){
       if(q.SBQQ__Status__c == 'Approved' && trigger.oldMap.get(q.Id).SBQQ__Status__c != 'Approved'){
           Id accountId = [SELECT SBQQ__Account__c FROM SBQQ__Quote__c WHERE ID=:q.Id].get(0).AccountId;
           Opportunity o = new Opportunity(Name=q.Name+' '+'Opportunity', AccountId= accountID, CloseDate=date.today(), StageName='Qualification', SBQQ__QuotePricebookId__c=q.SBQQ__PricebookId__c);
           System.debug('My Name' + o);
           q = [ select id from SBQQ__Quote__c where id = :q.id limit 1];
           q.SBQQ__Opportunity2__c = o.Id;
           q.SBQQ__Primary__c = True;
           q.SBQQ__Account__c = accountID;
           Opportunity o2 = [ select id from Opportunity where id = :q.SBQQ__Opportunity2__c limit 1];
           o2.StageName='Closed Won';


Prevent New Business Flows from Amendment or Add-On Flows

In both the Amendment and Add-On scenarios, you may want to prevent your customers from having the ability to create New Business Quotes.  Today, users can accomplish this by selecting Skip on the Select a Contract page.  

  1. Create a Theme that you want to use for your Customer Community.  
  2. Assign the Theme to a Profile through a workflow rule
    1. Setup > Create > Workflow & Approvals > Workflow Rules > New Rule
    2. Object = User
    3. Criteria = User Type equals Partner (for a Partner Community User. Varies depending on the type of Community License purchased)
  1. New Immediate Workflow Action
    1. Type = Field Update
    2. Name = Set Theme
    3. Field to Update = Theme
    4. Value = Use a formula to set the new value
    5. Formula = Document ID for the Theme, enclosed in single-quotes

Branding the CPQ Experience in a Customer Community

For more information on branding, review the Theming Community article.


Hiding Actions and Fields  from Community Users

Salesforce QTC Best Practices recommend planning and reviewing any fields and actions you wish to hide from your customers. For example, you wouldn’t want a Community User to give themselves an Additional Discount. Customers may not need access to Quote Line Editor actions that sales reps use, either - you may only want your customers to use Add Products, Calculate, Cancel, and Save.

by josephdesch
on ‎06-27-2017 04:49 PM

I'm able to access the Quote object through a community, but when I click the "Edit Lines" button, I get an infinite spinner. I'm using CPQ 28.0.12 and the Napili community format. Any suggestions?

by josephdesch
on ‎07-17-2017 02:47 PM

FYI, I was able to resolve my comment above by simply Publishing the community. I'm new to communities, so forgive my ignorance for these simple questions.

by josephdesch
on ‎07-17-2017 09:09 PM

In addition, this code snippet will not save properly if copied and pasted from this article. To fix, replace this line:


Id accountId = [SELECT SBQQ__Account__c FROM SBQQ__Quote__c WHERE ID=:q.Id].get(0).AccountId;

With this line:


Id accountId = [SELECT SBQQ__Account__c FROM SBQQ__Quote__c WHERE ID=:q.Id].get(0).SBQQ__Account__c;

 See this community post for further details: