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
Nishant Shrivastava 30Nishant Shrivastava 30 

Records in Lightening Web Component is retrieving as string not as record

Please check the screenshot as well. while searching for record it shows record available as string not as record. I want to retrieve it as standard record and want it to be clickable. You are kindly requested to assist me thereto. 

HTML Code
 
</lightning-card>
<lightning-card title="Record Details" icon-name="custom:custom63">
    <div class="slds-m-around_medium">
        <lightning-input type="search" onchange={handleKeyChange} class="slds-m-bottom_small" label="Search" value={searchKey}></lightning-input>
        <template if:true={recorddetails.data}>
            <template for:each={recorddetails.data} for:item="datas">
                <p key={datas.Id}>{datas.Name}</p>
            </template>
        </template>
    </div>
</lightning-card>


Javascript Code :

 

import { LightningElement, api, wire, track } from 'lwc'; 
import methodName from '@salesforce/apex/MoveAttachment.methodName';
import fetchRecord from '@salesforce/apex/MoveAttachment.fetchRecord';

handleChange(event) {
        this.selectedLabel = event.detail.value;
    }
    //@wire(fetchRecord, {CustomWrapper:'$parameterObject'})recorddetails;
    
    @wire(fetchRecord, {searchKey:'$searchKey', selectedLabel:'$selectedLabel'})recorddetails;
    @wire(fetchRecord)
    wiredRecordDetails({errors, datas}){
        if(datas){
            if(datas.length>0){
                for(let i=0;i<datas.length;i++)
            {
                this.records.push ({label: datas[i].Name, value: datas[i].Id });
                console.log('check=====>', this.records[i]);
            }
        }
            this.results = this.records;
        } else if (errors){
            this.errors = errors;
            this.results = undefined;
        }
    }
    handleKeyChange(event) {
        // Debouncing this method: Do not update the reactive property as long as this function is
        // being called within a delay of 500ms. This is to avoid a very large number of Apex method calls.
        
        window.clearTimeout(this.delayTimeout);
        const searchKey = event.target.value;//this.template.querySelector('lightning-input').value;
        this.delayTimeout = setTimeout(() => {
            this.searchKey = searchKey;
        }, 
        );
        this.results;
    }
I shall be grateful to you for your kind assistance.

​​​​​​​Thanks and regards