Row not updating using updateRows()

LabKey Support Forum
Row not updating using updateRows() la27  2019-06-05 09:38
Status: Closed
 
Hello,

I have Java script code that says this:

 LABKEY.Query.updateRows({
        schemaName:"lists",
        queryName :"Reagent Requests",
        rows: [{"Key": 3,
            "ClientId": "123",
        }]
    });

I am trying to update the Reageant Requests Tutorial Form's row 3's cell named ClientId with 123. I have made sure the keyname is Key but it will not update. It gives me "existing row not found." I put this function in the submitRequest() function found in the tutorial code.

   function submitRequest() {

        // Insert form data into the list.
       LABKEY.Query.insertRows({
           schemaName: 'lists',
           queryName: 'Reagent Requests',
           rowDataArray: [{
               "Name": document.ReagentReqForm.DisplayName.value,
               "Email": document.ReagentReqForm.Email.value,
               "UserID": document.ReagentReqForm.UserID.value,
               "Reagent": document.ReagentReqForm.Reagent.value,
               "Quantity": parseInt(document.ReagentReqForm.Quantity.value),
               "Date": new Date(),
               "Comments": document.ReagentReqForm.Comments.value,
               "Fulfilled": 'false'
           }],
           success: function(data) {
               // The set of URL parameters.
               var params = {
                   "name": 'confirmation', // The destination wiki page. The name of this parameter is not arbitrary.
                   "userid": LABKEY.Security.currentUser.id // The name of this parameter is arbitrary.
               };

                // This changes the page after building the URL. Note that the wiki page destination name is set in params.
               var wikiURL = LABKEY.ActionURL.buildURL("wiki", "page", LABKEY.ActionURL.getContainer(), params);
               window.location = wikiURL;
           }
       });
   
    LABKEY.Query.updateRows({
        schemaName:"lists",
        queryName :"Reagent Requests",
        rows: [{"Key": "3",
            "ClientId": "123",
               }]
               });
               
}


 </script>
 
 
Jon (LabKey DevOps) responded:  2019-06-18 20:49
Hello,

Although we are not able to debug your code, I can tell you for certain that your LABKEY.Query.updateRows() call is correct based on our documentation.

https://www.labkey.org/download/clientapi_docs/javascript-api/symbols/LABKEY.Query.html#.updateRows

If you are receiving a message stating that "Existing Row Not Found", then that row definitely does not exist. I would recommend you access the list in question and be sure to expose all of the columns in your grid view, including the Key column and confirm what row values you have for the Key column. It is likely that this particular row was deleted and if you had tried to re-input the row and your list is setup as an Auto-Incrementing Integer, the Key column value would be different for this newly re-entered row.

Regards,

Jon