I'm trying to navigate to the contact record page from the account object details page.
theThe scenario is,: In the Account object there are multiple contacts available. when iWhen I click on any of the contacts, it should open on the Contact object details page. I'm tryngtrying it by using NavgigationNavigation mixin and by passing on the recordId, but it will open on account objects only can.
Can any one try to guide me how to do this?!
import { LightningElement, track, wire, api } from 'lwc';
import findContacts from '@salesforce/apex/GetContactController.getContacts';
import { NavigationMixin } from 'lightning/navigation';
const DELAY = 300;
export default class GetContactOnAccount extends NavigationMixin(LightningElement) {
@track searchKey = '';
@api recordId;
@wire(findContacts, { searchKey: '$searchKey' })
contacts;
navigateToNewContactPage() {
this[NavigationMixin.Navigate]({
type: 'standard__recordRelationshipPage',
attributes: {
recordId: this.recordId,
objectApiName: 'Account',
relationshipApiName: 'Contacts',
actionName: 'view'
},
});
}
//connectedCallback function is similar to init method in Lightning Components.
connectedCallback(){
this.searchKey = this.recordId;
}
}
import { LightningElement, track, wire, api } from 'lwc';
import findContacts from '@salesforce/apex/GetContactController.getContacts';
import { NavigationMixin } from 'lightning/navigation';
const DELAY = 300;
export default class GetContactOnAccount extends NavigationMixin(LightningElement) {
@track searchKey = '';
@api recordId;
@wire(findContacts, { searchKey: '$searchKey' })
contacts;
navigateToNewContactPage() {
this[NavigationMixin.Navigate]({
type: 'standard__recordRelationshipPage',
attributes: {
recordId: this.recordId,
objectApiName: 'Account',
relationshipApiName: 'Contacts',
actionName: 'view'
},
});
}
//connectedCallback function is similar to init method in Lightning Components.
connectedCallback(){
this.searchKey = this.recordId;
}
}