You need to sign in to do that
Don't have an account?
Karthik j
How to navigate to the related list of custom object in LWC
Hi All,
I have a requirement to navigate to the related list of the custom object in lwc. I am sharing my code below.
handleClick(){
console.log('recordId>'+this.recordId);
this[ NavigationMixin.Navigate ]( {
type: 'standard__recordRelationshipPage',
attributes: {
recordId: this.recordId,
objectApiName: 'FreshDesk_Ticket__c',
relationshipApiName: 'SRF_SPR__r',
actionName: 'view'
}
} );
}
The above code is taking me to the below page instead of related list.
If the child object is standard one you can write object name by adding extra 's' at the end, but how to do it with custom object?
Any help would be appreciated.
I have a requirement to navigate to the related list of the custom object in lwc. I am sharing my code below.
handleClick(){
console.log('recordId>'+this.recordId);
this[ NavigationMixin.Navigate ]( {
type: 'standard__recordRelationshipPage',
attributes: {
recordId: this.recordId,
objectApiName: 'FreshDesk_Ticket__c',
relationshipApiName: 'SRF_SPR__r',
actionName: 'view'
}
} );
}
The above code is taking me to the below page instead of related list.
If the child object is standard one you can write object name by adding extra 's' at the end, but how to do it with custom object?
Any help would be appreciated.
Requesting you to visit this Blog once for your requirement -> https://www.salesforcebolt.com/2022/09/uiRelatedListApi-get-related-list-metadata-and-records-data-salesforce.html
Hope it helps !
Thank you for your reply,
The blog link which you have shared explains how to display RelatedList data, but my requirement is to navigate to the standard related list of the custom object rather than displaying the related list data.
Just posting the answer here, To help those who might stucked with the same problem.
handleClick(){
window.open(window.location.origin+'/lightning/r/'+this.recordId+'/related/SRF_SPR__r/view','_self');
}