Quantcast
Channel: SharePoint 2010 - Development and Programming forum
Viewing all articles
Browse latest Browse all 11571

Pass parameter to success method of ExecuteQueryAsync

$
0
0
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.

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'); }



Viewing all articles
Browse latest Browse all 11571

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>