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
Mike Tol 1Mike Tol 1 

Get leads in input fields

I have leadtable as in the image

User-added image

I need get leads in input fields to save them automatically. In inputs, it is necessary to simultaneously receive leads from the database and change them with saving. They should be saved when you change something. When entering the new value of the field this value should be saved in the database automatically (user should not click on some button). Please tell me how can I do that.

My code.
    <lightning-card title="Leads">

            <lightning-record-edit-form object-api-name="Lead">

               <lightning-input-field field-name={Name}></lightning-input-field>
               <lightning-input-field field-name={Title}></lightning-input-field>
               <lightning-input-field field-name={Phone}></lightning-input-field>

                <!-- <lightning-input-field field-name="Title"> </lightning-input-field>
                <lightning-input-field field-name="Title"> </lightning-input-field> -->
            <!-- <lightning-layout-item size="12" padding="around-small">
                <lightning-datatable key-field="id" data={leads} columns={columns}></lightning-datatable>
            </lightning-layout-item> -->

import { LightningElement, wire} from 'lwc';
import getLeads from '@salesforce/apex/Qqq.getLeads';
import NAME_FIELD from '@salesforce/schema/Lead.Title';
import TITLE_FIELD from '@salesforce/schema/Lead.Title';
import PHONE_FIELD from '@salesforce/schema/Lead.Phone';
// const columns = [
//     { label: 'Name', fieldName: 'recordLink', type: 'url',
//         typeAttributes: {label: {fieldName: "LeadName"}, tooltip: "Name", linkify: true} },
//     { label: 'Title', fieldName: 'Title', type: 'text', editable: true },
//     { label: 'Phone', fieldName: 'Phone', type: 'text', editable: true }    
// ];
export default class LeadTable extends LightningElement {
    leadTitle = NAME_FIELD;
    leadTitle = TITLE_FIELD;
    leadPhone = PHONE_FIELD;
    // columns = columns;
    // leads;
    wiredLeads(value) {
        const {error, data} = value;
        if (data) {
            let leadData = JSON.parse(JSON.stringify(data));  
            leadData.forEach(record => {
                record.recordLink = "/" + record.Id;  
                record.LeadName = record.Name;
            this.leads = leadData;
        } else if (error) {
            this.error = error;

public with sharing class Leads {
    public static List<Lead> getLeads() {
        List<Lead> leads = [
            SELECT Id, Name, Title, Phone
            FROM Lead         
            Limit 3
        System.debug('leads = ' + leads);
        return leads;                
PriyaPriya (Salesforce Developers) 

Hey Mike,

Check this link if it help :-


Priya Ranjan