SharePoint 2010 Enterprise on our network. Same site, same page, same time of day, same code behind yet sometimes our client side code functions and sometimes it doesn't. when pulling the custom code out from the IE Dev view and doing a compare everything is the same. it's as though there is sometimes something written to the page that interferes with our custom .js and sometimes it is not written and there seems to be no pattern. We place our code in the styles library and are careful not to reference jquery more than once to the page.

Does anyone have any suggestions as to what might be differential running our custom client side .js code? we are at a loss.

here is an example of code that this will happen to:

<!doctype html>

<html xmlns:mso="urn:schemas-microsoft-com:office:office" xmlns:msdt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882">


<meta charset="utf-8">

<title>Start Fix Doc Type Item Workflow</title>



//alert("0 are we working or not?");


$(document).ready(function () {

    ////////////  CAPTURES CHECKED IID'S

        $("#xstartWorkflowUndeclareRecord").click(function () {


        arr1 = [];

var srcUrl = location.protocol + "//" + location.host + L_Menu_BaseUrl + "/";


// RELOADS PAGE AFTER AJAX PROCESSED                         


    alert("All process requests completed");



        $("INPUT:checkbox:checked").parent().parent().each(function () {

            var xval = ($(this).attr('iid')).split(",")[1]; //DELETES PREFIX

            //alert("New xval= " + xval);


                                                $("div #xWriteIDNumber").text('ID# to be processed:  ' + arr1 );

           // alert(arr1) //DISPLAYS ALL CHECKBOX IID

            $(arr1).each(function () {  //ERROR CREATES EXTRA CALL WHY?

                //alert("New xval= " + xval);


////////////////////////////////////START WEB SERVICE CALLS

//alert("wf run"+xval);

var itemId = xval;

var listName = 'Project Management';

var workflowName = 'xUndeclare as Record';

var associationData = '';

//var webMethod = 'https://vaww.portal2.va.gov/sites/localresearch/Phoenix/_vti_bin/NintexWorkflow/Workflow.asmx'

var webMethod =  srcUrl + '/_vti_bin/NintexWorkflow/Workflow.asmx'; // e.g., "https://vaww.portal2.va.gov/sites/localresearch/Phoenix"

var soap= "<?xml version=\"1.0\" encoding=\"utf-8\"?>" +

                        "<soap:Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">" +

                          "<soap:Body>" +

                            "<StartWorkflowOnListItem xmlns=\"http://nintex.com\">" +

                              "<itemId>" + itemId + "</itemId>" +

                              "<listName>" + listName + "</listName>" +

                              "<workflowName>" + workflowName + "</workflowName>" +

                              "<associationData></associationData>" +

                            "</StartWorkflowOnListItem>" +

                          "</soap:Body>" +


//alert("wf run2 = "+xval);


            type: "POST",

            url: webMethod,

            beforeSend: function(xhr) { xhr.setRequestHeader("SOAPAction", "http://nintex.com/StartWorkflowOnListItem");},

            data: soap,

            contentType: "text/xml; charset=utf-8",

            dataType: "xml",

            //success: function(data) { alert('The item with ID# of ' + itemId + ' will undeclared as record.');window.location.reload(); },

                                                //success: function(data) { alert('The item with ID# of ' + itemId + ' will undeclared as record.') },

                                                success: function(data) {$("#responseUndeclare").append('Item ID# ' + itemId + ' undeclared as record. ');},

            target: "#waitBoxUndeclare",

            //error: function (e) { alert('The workflow has failed to run'); alert(e.responseText); }

                                                error: function (e) { alert('The workflow has failed to run because another workflow is already running on this item which can be verified by examining the items workflow history'); }

}); //END AJAX 

//alert("wf run afer end ajax = "+xval);         

//////////////////////////END WEB SERVICE CALLS CODE  

        }); //END EACH

        // alert(arr1);

    }); //END CLICK

some suggestions:

  • make sure all resources are checked in and published
  • clear the browser cache completely before testing
  • keep dev console open and check for script errors
  • use jquery.noconflict
  • leverage document.ready vs window.onload
  • check behaviour in different browsers, machines, and user accounts

good luck

  • This is very useful overview info. thanks. we've even had the same page write: id="whatever" and on another occasion write the id without the quotes, id=whatever, needless to say blew up the JQUERY referencing it. There was no change made to anything. its as though the processing instructions get gummed up intermittently without obvious pattern or cause. Jul 14 '14 at 15:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.