You need to sign in to do that
Don't have an account?
VijayNi
record ID and object not visible in account record page using @api decroator
Hi Team,
I am using @api record and @objectApiName in my ligthinging web component but the data record id and objevt details are not visible on my record page .
Please find the screenshot of account record page from the app builder page where the component i added it to the record page but it's not displaying the record id or object details .
Account record page after saving the component and refresh also i couldn't see the component in my account record page
Js file :
import { LightningElement,api } from 'lwc';
export default class CurrentRecordAndObjectInfo extends LightningElement {
@api recordId;
@api objectApiName;
}
Html file :
<template>
<lightning-card title="current Record and object Info" icon-name="standard:user">
<div class="slds-m-around_medium">
<p> Record Id <strong>{recordId}</strong></p>
<p> Object Api Name <strong>{objectApiName}</strong></p>
</div>
</lightning-card>
</template>
Meta.xml file :
<?xml version="1.0" encoding="UTF-8"?>
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion>51.0</apiVersion>
<isExposed>true</isExposed>
<targets>
<target>lightning__AppPage</target>
<target>lightning__RecordPage</target>
<target>lightning__HomePage</target>
</targets>
</LightningComponentBundle>
Thanks,
Vijay.
I am using @api record and @objectApiName in my ligthinging web component but the data record id and objevt details are not visible on my record page .
Please find the screenshot of account record page from the app builder page where the component i added it to the record page but it's not displaying the record id or object details .
Account record page after saving the component and refresh also i couldn't see the component in my account record page
Js file :
import { LightningElement,api } from 'lwc';
export default class CurrentRecordAndObjectInfo extends LightningElement {
@api recordId;
@api objectApiName;
}
Html file :
<template>
<lightning-card title="current Record and object Info" icon-name="standard:user">
<div class="slds-m-around_medium">
<p> Record Id <strong>{recordId}</strong></p>
<p> Object Api Name <strong>{objectApiName}</strong></p>
</div>
</lightning-card>
</template>
Meta.xml file :
<?xml version="1.0" encoding="UTF-8"?>
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion>51.0</apiVersion>
<isExposed>true</isExposed>
<targets>
<target>lightning__AppPage</target>
<target>lightning__RecordPage</target>
<target>lightning__HomePage</target>
</targets>
</LightningComponentBundle>
Thanks,
Vijay.
that is perfectly work in my org.
If you want to check that you can print the recorded and ObjectApiName in Console.log and check that the Id is get or not in the console.
for your referral link is below:
https://www.sfdcpoint.com/salesforce/get-record-id-in-lightning-web-component/
https://developer.salesforce.com/docs/component-library/documentation/en/lwc/lwc.use_record_context
If you having a problem after that then please reply to me
Please Mark as the best answers if you find your answer.
thanks, And regards,
Suraj Tripathi.
All Answers
Your LWC Works Fine In My Org
Please Re-Deploy And Remove Your LWC Component From Page And Add Again On Page And Check
Please Mark it As best Answer If It Helps
Thank You!
I have tried the above steps i am still facing the same issue it's working fine in another org .
I have tried clearing cache still i am seeing the same issue
Thanks,
Vijay.
that is perfectly work in my org.
If you want to check that you can print the recorded and ObjectApiName in Console.log and check that the Id is get or not in the console.
for your referral link is below:
https://www.sfdcpoint.com/salesforce/get-record-id-in-lightning-web-component/
https://developer.salesforce.com/docs/component-library/documentation/en/lwc/lwc.use_record_context
If you having a problem after that then please reply to me
Please Mark as the best answers if you find your answer.
thanks, And regards,
Suraj Tripathi.