Create a Custom Controller for the Quip Associated Documents Component

Add your Lightning component to more Salesforce records when you create a custom controller.

Required Editions

Available in: Salesforce Classic
User Permissions Needed
To customize a controller: Customize Application
  1. Create a new Apex class.
  2. Name it myCustomOppController.
  3. Name your page QuipCard.
  4. Copy and paste the following code.
    public class myCustomOppController {
        public String recordId {get; set;}
        
        public myCustomOppController(ApexPages.StandardController stdController) {
            setRecordIdForQuip(stdController.getRecord().id);
        }
        
        private void setRecordIdForQuip(Id recordId) {
            this.recordId = recordId;
        }
    }
  5. Replace your QuipCard.vfp code with this code.
    <apex:page sidebar="false" standardController="Opportunity" extensions="myCustomOppController" >
      <apex:includeLightning />
      <div id="quipCardContainer"/>
      
      <script>
        $Lightning.use("c:QuipCard", function() {
            $Lightning.createComponent("lightning:quipCard", 
            { "parentRecordId": "{!recordId}" },
            "quipCardContainer",
            function(cmp) {}
          );
        });
      </script>
    </apex:page>