I'm trying to build a workflow that will copy a list items to another site collection list. How do I go about it?
Solved! Go to Solution.
I did try that and it works well with document libraries. I trying to copy a list to another site collection. Maybe I’m not using the action correctly.
Jim Tucker, P.E., PMP
Project Information Management
Hi Jim Tucker ,
Instead of Copy item, use "Create Item in another site" action for list items. Here you can match the columns and populate the fields as desired. hope it helps.
Jim, Kapil has the correct approach - you can't use the Copy actions on list items. There are two possible approaches, depending on whether the workflow is in the source List you're copying - one at a time, or if its a site or scheduled workflow where you're processing multiple items. In the second approach, you'll need to use Query actions to gather all the attributes for each item in a loop, then write those attributes into the new item created in the target location.
If you want to be able make changes in the source list and apply those in the target list - it gets a little more involved, but is possible.
I have this working. The environment is a school. I have a student site collection in a webapp A going to a parents site collection in web app B.
I found the other copy and create items actions do not work well across site collections, only within the same site collection.
You need to use a call web service action to make it work.
First use build string action to construct an XML packet into a multi line variable.
My XML is using the fields from the source list.
<Batch OnError="Continue" ListVersion="1" >
<Method ID="1" Cmd="New">
I then use a call web service action to call the lists.asmx in the destination site.
I use a workflow constant for a secured user credential.
Use the UpdateListItems method.
Pass in the name of the list and the XML packet.
I also have another of other variables to capture the output and if an error occurred.
After the call web service action, I have a run if action to test the Boolean(Y/N) field if an error occurred.
and if it did I email off the details.
Hope this helps.
What if in the workflow creates a new list then Query for specific items in List A to copy to List B that was created in the workflow? Its difficult to use the create item in another site if the list is non-existent yet.
Ojbective is there is a main list that we copy and paste data into the Main List "datasheet." The workflow will then parse the data based on the Title column and create a new list base off the Main List template for each unique Title. This way we only have to dump data into one big list and the workflow does the rest to create new list from the Main list. Hope that make sense.
On the call web service action the name of the list can be a variable.
(In the listname (string) bit)
So after you create the list
you could then call the web service against it.
It's a bit strange to think about how many libraries to create though.
I'd have concerns over scale issues. Possibly look to split it into multiple workflows with the create list bit being in a separate workflow.