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
vinni shreevinni shree 

How to use condition inside then

I have fetched records, what i want is if no records are fetched then noaccounts value should be set to false but i'm unable yo do it 

Here is my code please help

handleSearchKeyword() {
if (this.searchValue !== '') {
getAccountList({
searchKey: this.searchValue
})
.then(result => {
this.accounts = result;
console.log(this.accounts);
})
.catch(error => {
});
}
}

Thank you

AnkaiahAnkaiah (Salesforce Developers) 
Hi Vinni,

can you explain more about your requirement?

Thanks!!
vinni shreevinni shree

Hi Ankaiah,

When user enter data in input fields and click on search button it should display the accounts similar to the entered text.If there are no account records depednding on enter value then there is property called noaccounts whose value should be set to false.

In the code i have shared it is displaing records and if no records are there I'm not understanding how to set noaccounts value to false.

Thank you