-
-
Save furkankaracan/a20dd38c1071fd0cc030c8dd65bd0b20 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CopyOpportunity: function (primaryControl) { | |
try { | |
//showProgressIndicatior | |
Xrm.Utility.showProgressIndicator("Please wait while processing your request"); | |
//Save current record first once copy button is getting clicked | |
primaryControl.data.save().then(function () { | |
var recordURL = primaryControl.getUrl(); | |
var actionName = "ad_CloneRecord"; | |
executeAction(recordURL, actionName, primaryControl); | |
}, | |
function () { | |
alert("An Error has occured. Please contact with your System Administrator."); | |
}); | |
} catch (error) { | |
Xrm.Utility.closeProgressIndicator(); | |
console.log(error); | |
throw "An Error has occured. Please contact with your System Administrator."; | |
} | |
}, | |
executeAction: function (recordURL, actionName, primaryControl) { | |
var req = {}; | |
req.RecordURL = recordURL; | |
req.Prefix = prefix; | |
req.FieldsToIgnore = fieldsToIgnore; | |
req.getMetadata = function () { | |
return { | |
boundParameter: null, | |
parameterTypes: { | |
"RecordURL": { | |
typeName: "Edm.String", | |
structuralProperty: 1 | |
}, | |
"Prefix": { | |
typeName: "Edm.String", | |
structuralProperty: 1 | |
}, | |
"FieldsToIgnore": { | |
typeName: "Edm.String", | |
structuralProperty: 1 | |
}, | |
}, | |
operationType: 0, | |
operationName: actionName | |
}; | |
}; | |
var successCallbackExc = function (result) {}; | |
var errorCallbackExc = function (error) { | |
Xrm.Utility.closeProgressIndicator(); | |
alert(error.message); | |
}; | |
Xrm.WebApi.online.execute(req).then(successCallbackExc, errorCallbackExc); | |
}, |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment