2

Does anyone know how to copy a list item from 1 list to another list in a different site using SharePoint Designer for workflows? I am using SharePoint 2010 Foundation, and would prefer not to use any third-party tools to achieve this.

Thanks!

3

Unfortunatly, no. You can only reach what is within your site collection using SPD Workflow Designer. You can make your workflow in VS, or you can use SPServices to update your list on the other site colleciton using JQuery.

UPDATE:

For clarity, use a CEWP on your page you want to copy from. Then in your CEWP do something like this using SPServices and JQuery. You need to capture the "copy to" list ID so you can reference what it is you are updating on the "copy to" list. Put this as a column in your "copy from" list:

<script type="text/javascript" src="/_layouts/js/jquery-1.11.0.js"></script>
<script type="text/javascript" src="/_layouts/js/jquery.SPServices-2014.01.js"></script>


<script type="text/javascript">


$(document).ready(function() {

$().SPServices({
operation: "GetListItems",
async: false,
listName: "Your List You Copy From",
CAMLViewFields: "<ViewFields><FieldRef Name='myItem' /><FieldRef Name='CopyToID' />",

completefunc: function (xData, Status) {

//alert(xData.responseXML.xml);

$(xData.responseXML).SPFilterNode("z:row").each(function() {
    var xitem = $(this);
    var myItem = xitem.attr("ows_myItem");
    var id = xitem.attr("ows_CopyToID"); //captured list id of "Copy to" list ID


    $().SPServices({
      operation: "UpdateListItems",
      async: false,
      webURL:"otherSiteCollecitonURL",
      debug:true,
      listName: "List to copy to",
      ID: id,
      valuepairs: [["Your Column", myItem]],
      completefunc: function (xData, Status) {

    }
  });


    });
   }
 });
});

</script>

This will run every time the page is refreshed or loaded, and it will update your list items on the other site collection, so it should work when your workflow runs to update your items on the other site colleciton list. This will trigger an update on the other site collection list, so if you have workflows that run on update, they will fire. Just play with it and see if it works for you.

  • Thanks lazoDev! For the purposes of the project I am working on, there really are no set in stone decisions as to where the source lists need to be located, so if I can get away with the lists located in the same site, then that would be great. However, your answer is very well detailed, and I really appreciate the work you've done for this question. I will absolutely keep your code as reference material should I be forced to move list items from one site to another. Again, thank you! – J-man Sep 18 '14 at 13:45
  • 1
    No Problem! I love using SPServices. I can usually find a way around most things with client-side manipulation. If you have never used it before, check it out spservices.codeplex.com they have good documentation for thier methods. – lazoDev Sep 18 '14 at 14:11

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.