Apex Page call PageReference refe = new PageReference(\"/apex/AAA\"); Only requirement of the js is recordId.", "answerCount": 5, "upvoteCount": 0, "datePublished": "2021-10-25T06:59:02.000Z", "author": { "@type": "Person", "name": "shylesh ragunayakam", "url": "https://trailblazers.salesforce.com/profileView?u=0054S0000016rVJQAY", "affiliation": { "@type": "Organization", "name": "ITSP" } }, "acceptedAnswer": { "@type": "Answer", "text": "@Gaius Libam https://trailblazers.salesforce.com/profileView?u=0053A00000FW2HsQAL  Apologies. I decided to proceed in a different manner to execute this flow. Thank you for your help. ", "upvoteCount": 1, "url": "https://trailhead.salesforce.com/trailblazer-community/feed/0D54S00000BtAe1SAF", "datePublished": "2021-10-26T21:10:52.000Z", "author": { "@type": "Person", "name": "shylesh ragunayakam", "url": "https://trailblazers.salesforce.com/profileView?u=0054S0000016rVJQAY", "affiliation": { "@type": "Organization", "name": "ITSP" } } }, "suggestedAnswer": [ { "@type": "Answer", "text": "Failed to save ABC.cmp: Lightning123456:ABC:2,222: Invalid attribute \"implements\": Source", "upvoteCount": 0, "url": "https://trailhead.salesforce.com/trailblazer-community/feed/0D54S00000BtAe1SAF", "datePublished": "2022-01-05T11:33:44.000Z", "author": { "@type": "Person", "name": "Lightning12345 ajay", "url": "https://trailblazers.salesforce.com/profileView?u=0054S000001UCjdQAG", "affiliation": { "@type": "Organization", "name": "Hcl" } } } ] } } Skip to main content

Hello,

 

I am trying to create a custom lightning web component accessed via visualforce page, but there seems to be an error. Upon analyzing the code and testing, I found out that the recordId is null.

I believe the issue is that recordId is not transferred. Could you help? 

 

ABC.cmp

<aura:component implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes,force:lightningQuickAction" access="global" >

<aura:attribute name="recordId" type="Id" />

<c:XYZ CardTitle="Create" recordId="{!v.recordId}" />

</aura:component>

- works fine (tested using object -> add button, action etc)

- XYZ component has no issues and is in javascript. It also opens /apex/Lightning_page?oid=recordId

 

Lightning App - ABCDE.app

<aura:application implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes" access="GLOBAL" extends="ltng:outApp">

<aura:attribute name="recordId" type="Id" />

<c:ABC recordId="{!v.recordId}"/>

</aura:application>

 

Lightning Web Component - AAA.vfp

<apex:page standardController="Opportunity">

<apex:includeLightning />

<apex:pageBlock >

<apex:pageBlockSection >

<div id="newQ" />

</apex:pageBlockSection>

</apex:pageBlock>

<script>

$Lightning.use("c:ABC", function(){

$Lightning.createComponent(

"c:ABCDE", {

recordId : '{!$CurrentPage.parameters.id}',

console.log('regular access record ID: '+recordId);

}, "newQ", function(cmp){

console.log('regular access record: ');

}

);

});

</script>

</apex:page>

 

Apex Page call

PageReference refe = new PageReference("/apex/AAA");

 

Only requirement of the js is recordId.

 

#Salesforce Developer #Lightning Web Components #Aura Lightning Components #Visualforce Pages #Apex Code

5 risposte
  1. 26 ott 2021, 21:10

    @Gaius Libam Apologies. I decided to proceed in a different manner to execute this flow. Thank you for your help. 

0/9000