quickUpdateListItem: Possible to use variable for column name?

Jun 20, 2012 at 8:05 PM

res = lists.quickUpdateListItem('MyListHere', { ID: ReqD, columnVar : userName });

 

In the above statement, is it possible to use the variable columnVar in this way? I have not been able to successfully get this to work. It does not throw an error, but it just simply doesnt update.

Jun 20, 2012 at 10:20 PM

After spending some quality time in the library, I came up with a solution:

It is possible, but its not very obvious. The library differentiates between what you're passing into the function. If you build an array and then pass that in instead, you can build this dynamically as I was hoping:

    var columnVar = whatever your column name is;
    
    var myArray = new Object();
    myArray['ID'] = ReqD;
    myArray[columnVar] = userName;    
    
    
    res = lists.quickUpdateListItem('MyListHere', myArray);