Hi
i found below code on MSDN, please help how to use this. or very helpful if i get any other alternate.. thanks
//A namespace defined for SDK sample code
//You should define a unique namespace for your libraries
var Sdk = window.Sdk || { __namespace: true };
(function () {
//A global variable to store information about enabled business processes after they are retrieved asynchronously
this.enabledProcesses = [];
// A function to log messages while debugging only
this.writeToConsole = function (message) {
if (typeof console != 'undefined')
{ console.log(message); }
};
//Code to run in the OnLoad event
this.formOnLoad = function () {
//Retrieve Enabled processes
Xrm.Page.data.process.getEnabledProcesses(function (processes) {
//Move processes to the global Sdk.enabledProcesses array;
for (var processId in processes) {
Sdk.enabledProcesses.push({ id: processId, name: processes[processId] })
}
Sdk.writeToConsole("Enabled business processes flows retrieved and added to Sdk.enabledProcesses array.");
//Write the values of the Sdk.enabledProcesses array to the console
if (Sdk.enabledProcesses.length < 0) {
Sdk.writeToConsole("There are no enabled business process flows for this entity.");
}
else {
Sdk.writeToConsole("These are the enabled business process flows for this entity:");
for (var i = 0; i < Sdk.enabledProcesses.length; i++) {
var enabledProcess = Sdk.enabledProcesses[i];
Sdk.writeToConsole("id: " + enabledProcess.id + " name: " + enabledProcess.name)
}
}
//Any code that depends on the Sdk.enabledProcesses array needs to be initiated here
});
};
}).call(Sdk);









