I've tried to search in different locations but I can only see on most is "create button record"
My goal here is to create a custom button in my property booking object record page where in when I click that button it will navigate to the corresponding child record which is the quotation object.
In my app duplicates are not allowed so it will only open 1 quotation records that has the parent/master record.
Text Version of what I am trying to do...
"A button which when clicked should navigate to the corresponding quotation record / related quotation record of the property booking record"
Sample Property Booking record:
Id like to add a button here when if it is clicked it will go directly to the image below to the quotation record I know this is kind of done using navigationmixin.navigate but most tutorials I see is they use a lightning-record-view which in my case I dont need to
Sample Quotation Record: Booking Ref is the Master/Parent.
I don't know if I got this right but the relationship of my property booking record and quotation record is like this.
Viewed from the fields and relationship of the quotation object:
Lookup(Property Booking)
UPDATE: I have found that it is showing under my related list.
I have used the following code to navigate to it with this, but with no luck its not opening.
openQuote.js
import { LightningElement,api,wire } from 'lwc';
import { NavigationMixin} from 'lightning/navigation';
import { getRecord } from 'lightning/uiRecordApi';
export default class OpenQuote extends NavigationMixin(LightningElement){
//
@api recordId;
recordViewMode(){
this[NavigationMixin.Navigate]({
type: 'standard__recordRelationshipPage',
attributes:{
recordId: this.recordId,
objectApiName:'Property_Booking__c',
relationshipApiName: 'Quotations',
actionName:'view'
}
})
}
}
openQuote.html
<template>
<lightning-card title='Open Corresponding Quotation'>
<lightning-button variant="brand"
label="Open Quote"
onclick={recordViewMode}>
</lightning-button>
</lightning-card>
</template>
openQuote.js-meta.xml
<?xml version="1.0" encoding="UTF-8"?>
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion>55.0</apiVersion>
<isExposed>true</isExposed>
<targets>
<target>lightning__RecordPage</target>
</targets>
</LightningComponentBundle>
When I click the button open quote this is the result: