SPServices call not being recognized

May 2, 2014 at 5:18 PM
Edited May 2, 2014 at 5:52 PM
I've got SPServices 2014.01 and JQuery 1.11.0 both loading in my masterpage. I've got a button on my list view that calls the function below. While troubleshooting, I added some alerts to see where it's breaking. The last alert at the end is saying that the workflow guid is null, so it's not finding the ID within the middle part (after the 'SPServices operation called' alert box).
function Rename(ItemURL, ItemID){
alert('Starting function');
var workflowDiv = 'WorkflowDiv' + ItemID
var workflowGUID = null;

//Find Workflow TemplateID for current document library
  operation: "GetTemplatesForItem",
  item: ItemURL,
  debug: true,
  async: false,
  completefunc: function (xData, Status) {
alert('SPServices operation called');
    $(xData.responseXML).find("WorkflowTemplates > WorkflowTemplate").each(function(i,e) {
      // hard coded workflow name
      if ( $(this).attr("Name") == "Rename" ) {              
        var guid = $(this).find("WorkflowTemplateIdSet").attr("TemplateId");        
        if ( guid != null ) {
          workflowGUID = "{" + guid + "}";

//Show loading image
document.getElementById('wfloader').style.visibility = 'visible';

//Call Workflow
  operation: "StartWorkflow",
  item: ItemURL,
  debug: true,
  templateId: workflowGUID,
  workflowParameters: "<root />",
  completefunc: function() {
    alert('Workflow GUID is ' + workflowGUID + '.');


The end result is that the function should find the workflow called "Rename" associated with the current item, then trigger it. This was all working prior to yesterday, but I did something that broke it and I'm pulling my hair out trying to find it. The workflow itself runs fine if I manually trigger it, and I've confirmed that the workflow name is just "Rename" with no extra spaces or anything.
May 2, 2014 at 10:06 PM
Never mind - I figured it out by adding some logging into the script. Turns out I wasn't passing a proper URL to the function.
May 5, 2014 at 5:15 PM

I am trying to use SPServices in my list form (Calendar) for adding new event. My page is not able to recognize SPServices. Below is my code from some sample:
<!-- Reference jQuery on the Google CDN --><script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js" type="text/javascript"></script><!-- Reference SPServices on cdnjs (Cloudflare) --><script src="http://cdnjs.cloudflare.com/ajax/libs/jquery.SPServices/2013.02a/jquery.SPServices-2013.02a.min.js" type="text/javascript"></script>
<script type="text/javascript"> $(document).ready(function() { alert ("js on."); alert ('jQuery on.'); var thisSite = $().SPServices.SPGetCurrentSite(); alert ('Hello World! Your site is : ' + thisSite ); }); </script> I do get first 2 alerts but not the SPervices one

May 6, 2014 at 3:43 PM
Try this - it's working for me:
<script type="text/javascript">
$(document).ready(function() {
 alert ('jQuery version is ' + $.fn.jquery);
 var thisSite = $().SPServices.SPGetCurrentSite();
 alert ('Current site is ' + thisSite );
May 7, 2014 at 12:32 PM
I think the problem is your link to cdnjs. It should be: