Hi Abdul Wahab, Try the code below. function GetWorkflowIDByName(wfName) { var serverUrl = Xrm.Page.context.getServerUrl(); var wfID = null; //Prepare ODATA query to fetch WF GUID by WF Name var odataSelect = serverUrl + "/xrmservices/2011/OrganizationData.svc/WorkflowSet?$select=WorkflowId&$filter=ActiveWorkflowId/Id ne null and Name eq '" + wfName + "'"; $.ajax({ type: "GET", contentType: "application/json; charset=utf-8", datatype: "json", url: odataSelect, beforeSend: function (XMLHttpRequest) { XMLHttpRequest.setRequestHeader("Accept", "application/json"); }, success: function (data, textStatus, XmlHttpRequest) { if (data.d != null && data.d.results != null && data.d.results.length != 0 && data.d.results[0].WorkflowId != null) { wfID = data.d.results[0].WorkflowId; } }, error: function (XmlHttpRequest, textStatus, errorThrown) { alert('OData Select Failed: ' + odataSelect); } }); } Hope this helps.
↧