---
schema_version: "1"
id: 07603f0e3090411c0968d135807bc91caf4ab68c00e9620a0a9e9ae55eecf611
title: Create a Custom Controller for the Quip Associated Documents Component
collection: admin
version: current
locale: en-us
portal_url: https://docs.salesforce.com/admin/current/en-us/xcloud/264-0-0/admin_files_quip_create_controller.md
canonical_url: https://help.salesforce.com/s/articleView?id=xcloud.admin_files_quip_create_controller.htm&release=264.0.0&type=5
source_site: help.salesforce.com
content_type: documentation
content_hash: 478edaeba85c2c42a815a28659907b689a4816fe6bdc6b332eba9a1a72731506
description: Add your Lightning component to more Salesforce records when you create a custom controller.
products:
  - Quip
  - Cross Cloud
release: "264"
---
# 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

<table class="slds-table slds-table_bordered slds-max-medium-table_stacked slds-m-bottom_small edition"><colgroup><col></colgroup><tbody><tr class=""><td class="slds-cell-wrap" style="vertical-align:top;">Available in: Salesforce Classic</td></tr></tbody></table>

<table class="slds-table slds-table_bordered slds-max-medium-table_stacked slds-m-bottom_small permission">
        <colgroup>
          <col style="width:50%">
          <col style="width:50%">
        </colgroup>
        <thead class="slds-text-title_caps ">
          <tr class="">
            <th scope="colgroup" class="slds-cell-wrap" colspan="2" style="text-align:center;vertical-align:top;" id="d27191e52">User Permissions Needed</th>
          </tr>
        </thead>
        <tbody>
          <tr class="">
            <td data-label="User Permissions Needed" class="slds-cell-wrap" style="vertical-align:top;" headers="d27191e52 ">To customize a controller:</td>

            <td class="slds-cell-wrap" style="vertical-align:top;" headers="d27191e52 ">Customize Application</td>

          </tr>
        </tbody>
      </table>

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>
    ```