Quantcast
Channel: Microsoft Dynamics CRM Forum - Recent Threads
Viewing all articles
Browse latest Browse all 46379

Workflow Id using JS

$
0
0

Hi all

I am using the following code to get the workflow Id but my code is not working

function getWorkflowId() {
    debugger;
    var workflowName = "List";//"0197a5a2-e574-49ac-8511-f1b50954ca52"
    var odataSelect = Xrm.Page.context.getServerUrl() + "/XRMServices/2011/OrganizationData.svc/WorkflowSet?$select=WorkflowId&$filter=StateCode/Value eq 1 and ParentWorkflowId/Id eq null and Name eq \'' + workflowName + '\'";
 
    var xmlHttp = new XMLHttpRequest();
    xmlHttp.open("GET", odataSelect, false);
    xmlHttp.send();
 
    if (xmlHttp.status == 200) {
        var result = xmlHttp.responseText;
 
        var xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
        xmlDoc.async = false;
        xmlDoc.loadXML(result);
         
        return workFlowID = xmlDoc.getElementsByTagName("d:WorkflowId")[0].childNodes[0].nodeValue;
    }
}

Please suggest me Where am I wrong?

Thank You


Viewing all articles
Browse latest Browse all 46379

Trending Articles