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 

i am not able to update the field namely status

here is my code, kindly provide input, i am taking invoice id from checkbox and comparing it in my query and trying to update the field downloaded__c = true but it is not working. any help will be appreciable and thanks in advance


 function updateRecords() {
             const checkboxes = document.querySelectorAll('input[type=checkbox].invoiceCheckBox:checked');
             var recordsData = []; 
       
             for (let i = 0, l = checkboxes.length; i < l; i++) {
                recordsData.push({id: checkboxes[i].dataset.id,}); 
                 console.log("nnnnn",recordsData);
                 let query = `SELECT id, Downloaded__c FROM kognoz1__Invoice2__c where id='${recordsData[i].id}'`;
                 let result = sforce.connection.query(query);
                 result.Downloaded__c = true;
                 var result1 = sforce.connection.update([result]);
                 }
                                     
}


i shall be grateful to you for your kind consideration.