Hello, I've implemented batch case resolve functionality in my crm implementation. What's the most elegant approach for handling the completion message? The problem with the following implementation is that the completion message displays at
the end of the loop, but before the success callback:
function ResolveCases(statusCode)
{
var caseIds = SelectedControlSelectedItemIds;
alert('About to Resolve/Close ' + caseIds.length + ' case(s)');
for(var i=0; i<caseIds.length; i++) ResolveCase(statusCode, caseIds[i])
alert('Completed Resolve/Close of ' + caseIds.length + ' cases');
}
function ResolveCase(statusCode, caseId)
{
var incident = {};
incident.new_Action = 'Resolve|' + statusCode;
SDK.REST.updateRecord(
caseId,
incident,
"Incident",
function () {
//success
},
errorCallback
);
}