here code:
if (arrSelectedItemIds && arrSelectedItemIds.length > 0) {
if (oTask.arrTaskDetails.indexOf(arrSelectedItemIds[0].Id.replace(/{/, //).replace(/}/, //)) !== -1) {
oMC = oTask.oChecklistDetails[arrSelectedItemIds[0].Id.replace(/{/, //).replace(/}/, //)];
oConstants.sTaskId = oMC.sTaskId.replace(/{/, //).replace(/}/, //);
if (oMC.sFileName && oMC.sDocumentId) {
oCommon.BL.prepareDraftEmail(oMC.sRegardingType, oMC.sRegardingId, null, null, function (oResponse, sDocumentUrl) {
/use strict/;
if (oResponse && oResponse.filename) {
oValues.otl_filename = oResponse.filename;
oMC.sFileName = oResponse.filename;
}
if (oResponse && oResponse.documentid) {
oValues.otl_documentid = oResponse.documentid;
}
return Xrm.WebApi.updateRecord(/task/, oConstants.sTaskId, oValues);
}, null, oMC.sRecipientConfig
, oMC.sFileName, oMC.sDocumentId);
} else {
oTask.businessLogic.generateDocumentByTaskId(true, oMC.sRecipientConfig, oMC.sRegardingId, oMC.sRegardingType, oMC.sTaskId);
}
}
}
break;