Skip to main content
Bumped by Community user
Bumped by Community user
edited tags
Link
Derek F
  • 64.1k
  • 15
  • 55
  • 104

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;
        } 
    }

I'm trying to navigate to contact record page from account object details page.

the scenario is, In Account object there are multiple contacts available. when i click on any of contacts it should open on Contact object details page. I'm tryng it by using Navgigation mixin by passing recordId, but it will open on account objects only 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;
    }



}

I'm trying to navigate to the contact record page from the account object details page.

The scenario is: In the Account object there are multiple contacts available. When I click on any of the contacts, it should open on the Contact object details page. I'm trying it by using Navigation mixin and by passing on the recordId, but it will open on account objects only.

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;
        } 
    }
Source Link
user111857
user111857

Navigate to Contact record detail page from Account object

I'm trying to navigate to contact record page from account object details page.

the scenario is, In Account object there are multiple contacts available. when i click on any of contacts it should open on Contact object details page. I'm tryng it by using Navgigation mixin by passing recordId, but it will open on account objects only can any one try to guide me how to do this

js:

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;
    }



}