Quantcast
Channel: Microsoft Dynamics CRM
Viewing all articles
Browse latest Browse all 154803

Forum Post: RE: Workflow Id using JS

$
0
0
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.

Viewing all articles
Browse latest Browse all 154803

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>