Hello Andrew,
I am using the following code to clone the case record. While opening the cloned record, I need new guid. Can you please help me in that.
function ShowAlert_CloneCase() {
debugger;
Alert.show("Do you want to clone this existing case?", "", [
new Alert.Button("Clone", onAlertCloneButton), new Alert.Button("Cancel")
], "Info");
}
function HideAlert() {
Alert.hide();
}
function onAlertCloneButton() {
debugger;
Process.callWorkflow("6B537EDB-E446-442F-89FE-E993D05271B9",
Xrm.Page.data.entity.getId(),
function success() {
debugger;
alert("Workflow executed successfully");
try {
var url = "";
var guid = "";
if (Xrm.Page.getAttribute("new_guid") != null && Xrm.Page.getAttribute("new_guid").getValue() != null) {
url = Xrm.Page.getAttribute("new_guid").getValue();
var preUrl = url.substr(0, url.length - 55);
// Retrievinmg Guid - 184f3bc9-5d83-e811-81a1-0050568a58b2
guid = preUrl.substr(66);
Xrm.Page.getAttribute("new_waguid").setValue(guid);
// opening the newly created record using the guid
var windowOptions = { openInNewWindow: true }; Xrm.Utility.openEntityForm("incident", guid, null, windowOptions);
}
}
},
function () {
debugger;
alert("Error executing workflow");
});
}
function onAlertCloseButtonClick(args) {
Alert.hide();
}
Thanks!