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
Raghu Ch 2Raghu Ch 2 

Applying value to a particular record in for each loop - JS

let recordEditForm = this.template.querySelector('lightning-record-edit-form');
 let fields = {};
 this.fieldSetFields.forEach(field=> {
console.log('##### I am on line1254##### field value is ## '+ JSON.stringify(field.css));
 let keyVal = field.key;
 let fieldVal = this.template.querySelector('.' + keyVal).value;
 fields[field.fieldName] = fieldVal;
 //console.log('## I am on line 1187@@@@@@ ' + field + ' - '+ i);
 if(this[i].keyVal=='Sales_Authorization_Type__c-1'){
     console.log('##### i am on line 1186');
     field[i].css = this.keyVal + 'slds-show';
     console.log('@@@@ I am on line 1191@');
 }
 });

While iterting through JS for loop, the shown above, the css property 'slds-show' should apply to only the record that matches the if criteria, but sls-show property is being applied to all the elements which the loop is iterating over it. 

Let me know what the issue could be.