function iscopy() {
if (Xrm.Page.getAttribute("new_iscopy").getValue() == false) {
Xrm.Utility.confirmDialog("是否复制", yesCloseCallback, noCloseCallback)
}
}
function yesCloseCallback() {
Xrm.Page.getAttribute("new_iscopy").setValue(true);
Xrm.Page.data.entity.save();
setTimeout(creatord, 2000);
}
function noCloseCallback() {
return;
}
function creatord() {
var r = new hdREST();
var name = Xrm.Page.getAttribute("new_name").getValue();
filter = "new_checktaskSet?$orderby=CreatedOn desc&$filter=new_iscopy eq false";
var data = r.get(filter);
if (data.length > 0&&data[0].new_name==name) {
var id = data[0].new_checktaskId;
if (confirm("复制成功,是否打开?")) {
Xrm.Utility.openEntityForm("new_checktask", id);
}
}
}