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

Forum Post: RE: Workflow Id using JS

$
0
0
Your main error is that you're trying to parse xml of response but response is JSon. Your code should look like following: var req = new XMLHttpRequest(); req.open("GET", Xrm.Page.context.getClientUrl() + "/XRMServices/2011/OrganizationData.svc/WorkflowSet?$select=WorkflowId&$filter=Name eq 'test%20name' and ParentWorkflowId eq null and StateCode/Value eq 1", true); req.setRequestHeader("Accept", "application/json"); req.setRequestHeader("Content-Type", "application/json; charset=utf-8"); req.onreadystatechange = function() { if (this.readyState === 4) { this.onreadystatechange = null; if (this.status === 200) { var returned = JSON.parse(this.responseText).d; var results = returned.results; for (var i = 0; i < results.length; i++) { var workflowId = results[i].WorkflowId; } } else { Xrm.Utility.alertDialog(this.statusText); } } }; req.send(); I used this tool for generation of query and sampling of JavaScript - github.com/.../CRMRESTBuilder Try it - it's really helpfull.

Viewing all articles
Browse latest Browse all 154803

Trending Articles



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