I have seen how to pass a parameter to a callback method of the ExecuteQueryAsync SP.ClientContext object. The problem occurs when multiple calls are performed. The last value is always passed to the callback method. Below is a sample
of a while loop that performs multiple updates. cT contains the value i wish to pass. TitleVal in the success method always contains the last value.
Thanks in advance.
Thanks in advance.
While...{
cT = currentItem.get_item('Title');
ListItem.set_item("Approval_x0020_Status", currentItem.get_item('Approval_x0020_Status')); ListItem.set_item("Year", currentItem.get_item('Year')); ListItem.set_item("Delete_x0020_this_x0020_Risk_x00", currentItem.get_item('Delete_x0020_this_x0020_Risk_x00')); ListItem.update(); var SPContextUPD = new SP.ClientContext.get_current(); SPContextUPD.executeQueryAsync( Function.createDelegate(this, function() { CreateListItem_Success("'" + cT + "'"); }), Function.createDelegate(this, function() { CreateListItem_Fail(); }), );
} } function CreateListItem_Success(TitleVal){ SP.UI.Notify.addNotification(TitleVal + ' updated successfully'); }