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 |
-
Create a new Apex class.
-
Name it myCustomOppController.
-
Name your page QuipCard.
-
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;
}
}
-
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>