Hi All,
Recently I ran into a blocker while trying to call my custom global action using Javascript in CRM 2013 version.
I got one post by Deepak but that didn't work.
Finally I came through a solution in GitHub named as process.js. It contains Soap calls to Custom Action and workflow which worked perfectly for my scenario.
Below is the link:
https://archive.codeplex.com/?p=processjs
The above link of Codeplex moved to below link. Refer the below one.
https://github.com/PaulNieuwelaar/processjs
Download Process.js and use as a webresource.
How to call the method. Refer to sample velow:
function onLoad_CallActionFromProcess_JS(actionName, inputParamKey1, inputParamValue1,
inputParamKey2, inputParamValue2) {
debugger;
Process.callAction(actionName,
[{
//key: "Target",
//type: Process.Type.EntityReference,
//value: new Process.EntityReference("account", Xrm.Page.data.entity.getId())
key: inputParamKey1,//"RecordId",
type: Process.Type.String,
value: inputParamValue1//"2B5D9CB2-3805-E911-8114-000D3A707D26"
},
//{
// key: "ColumnSet",
// type: Process.Type.String,
// value: "name, statuscode"
//},
{
key: inputParamKey2,//"ReportType",
type: Process.Type.String,
value: inputParamValue2//"Over26"
}],
function (params) {
// Success
debugger;
var responseText = params.Results;
alert(responseText);
//alert("Name = " + params["Entity"].get("name") + "\n" +
// "Status = " + params["Entity"].formattedValues["statuscode"]);
},
function (e, t) {
// Error
debugger;
alert(e);
// Write the trace log to the dev console
if (window.console && console.error) {
console.error(e + "\n" + t);
}
});
}
Happy Coding!
Saqib