function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Karthik jKarthik j 

How display particular fields in lwc component using lightning-record-form

Hi all
I wrote a LWC that displays all the fields of the payment object and I placed this component on the Case page. But I want to display some particular fields of payment on this component. Can anyone please help me. I am a newbie to LWC.
Here is my code

HTML:

<template>
    <lightning-card title="Contact Information">
            <div class="slds-m-around-small">
                <lightning-record-form record-id = {recordId1}
                object-api-name = "Payment__c"
                mode= "readonly"
                layout-type= "Full"
                columns ="2"
                >
                </lightning-record-form>
            </div>
    </lightning-card>
</template>

JS:

import { LightningElement, track, wire, api } from 'lwc';
import getPaymentContactInfo from 
'@salesforce/apex/ContactsOnCaseController.getPaymentContactInfo';
export default class auditreport extends LightningElement {
   @api recordId;
   @api recordId1;
    
    @wire(getPaymentContactInfo, {PayId: '$recordId'}) 
    WireContactRecords({error, data}){
        if(data){
            this.recordId1 = data;
            this.error = undefined;
            
        }else{
            this.error = error;
            this.recordId1 = undefined;
        }
        console.log(this.recordId1);
     }
}

Apex:

public with sharing class ContactsOnCaseController {
    @AuraEnabled
    public static Id getPaymentContactInfo(string PayId){
     // return [select Contact_No_1__c,Contact_No_2__c,Contact_No_3__c,Contact_No_4__c from Payment__c where id in (select Payment__c from case where id=:PayId)];
     List<Payment__c>Paydetails= [select id from Payment__c where id in (select Payment__c from case where id=:PayId)];    
    return Paydetails[0].id;
    }
}