I'm adding a lightning out component to a pre-existing visualforce page. I can pass the values from the sObject bound in the Visualforce page to my Lightning Component by passing these as separate parameters (one for each required field) to associated attributes in my lightning component however I'd like to pass just one attribute and reference this for picking up the fields in my component.
On testing this out this afternoon I've been unable to get this to work.
My Lightning Out VF page is as follows
<apex:page standardController=“Impact__c” showChat="false" tabStyle="case" >
<apex:includeLightning />
<div id=“Incident”/>
<script>
$Lightning.use("c:SM_ProblemIncidentChange", function() {
$Lightning.createComponent("c:SM_ProblemIncident",
{incidentRecord: "{!Impact__c.Incident__r}"},
“Incident”,
function(cmp) {
});
});
</script>
</apex:page>
If I pass Incident__r
or Incident__c
I just get the id of the associated incident record in my component as opposed to a full sObject reference, or I'm not accessing these correctly in the component. if I do the following I can pass individual fields.
<apex:page standardController=“Impact__c” showChat="false" tabStyle="case" >
<apex:includeLightning />
<div id=“Incident”/>
<script>
$Lightning.use("c:SM_ProblemIncidentChange", function() {
$Lightning.createComponent("c:SM_ProblemIncident",
{incidentId: "{!Impact__c.Incident__r}”,
caseNumber: "{!Impact__c.Incident__r.CaseNumber}”},
“Incident”,
function(cmp) {
});
});
</script>
</apex:page>
Should I be able to pass the full sObject? Is seems the most logical approach instead of individual fields.
Lightning Data Service is not supported on Lightning Out.
Thanks in advance for any tips on this.