I am trying to push information from a SharePoint List on Site A to a SharePoint list on Subsite B or C. The main list has a column called "Customer URL" with the URL of the subsite the information is supposed to go to, and a column called "Customer Name" with the customers name.
I am trying to find a way to create a workflow so when a new item is added to the list on Site A, it sends the information to the list on either subsite based on the Customer name column. So once it sees it is for Customer A, it grabs the link in the Customer URL column, and sends the info to the list on that subsite. This is my problem, you can point it to a URL but you can't use variables. I can tell it to go to a URL if I type in the name, but I need it to send to a different URL each time based on the Customer Name. Please Help! 🙂
Solved! Go to Solution.
I am not sure what the real problem is
So you have a list in a parent site which has two columns: Client Name and Client List URL. After a new record is created you want to record a new item on the list provided in the Client List URL? What type of data?
Can you try to describe your question in a more detailed way?
Good day Drew,
I'm not sure that there is a easy clean action for this because the Create Item in another site action wants an URL before you can specify the list, which means that you can't make it dynamic. You can use the Create Item in another site if there is a fixed amount of clients and you use a switch action to look for the client name and based on that you create 10 or so different Create Item in another site Actions below the switch action that is hard coded for every client individually. But I guess this is not the case.
You will probably have to use a Sharepoint webservice (use the Call Web service action in Nintex) to create the item. I didn't look into this to much but you will have to call the target site in the url field, i.e. http://<TARGET_Site>/_vti_bin/Lists.asmx like shown below:
This site will help you structure your XML - https://msdn.microsoft.com/en-us/library/office/websvclists.lists.updatelistitems(v=office.14).aspx
Let me know if you need more information on this.
Thank you for the response. I thought about the switch idea as I use it on another part of the corporate site, but for this we have over 100 customers, and I am looking for my primary list to post to a subsite based on the customer name. I will give a more detailed explanation per the request above:
I have a main site with a Project list. This list has projects for all of the customers in our company. I also have a list called "Customers" that the Project list uses a lookup column with to get the customer name. For each of the customers, I am wanting to create a subsite. On each subsite, there would be a list with all of their projects on it. I am looking to make it so everytime an entry is added to the Project list on my main site, it says "Who is the customer for this entry?" And uses that customer name to identify the URL needed to push the information to the subsite. I was going to create the subsites using the customer name added to the end of the url (example.com/customer). I also have a column on the main project list called "Site URL". So once it identifies the customer name on a new entry, it gets the URL from that column, and sends the entry to that sites project list (all subsites project lists will have the same name).
I have been trying to follow examples online of the RestAPI doing this, I tried updatelistitems but couldn't get it to go to multiple sites, and tried the copy.asmx which can be used to move documents etc with no luck either. My problem is I need it to send the new list item to a subsites list depending on the customer name and URL field so I'm not hardcoding it into the workflow and I just can't figure it out. Any help would be appreciated if you guys had any examples or code I could look at! Let me know if you have any other questions.
Tomasz, I included a more detailed description below. I have been attempting to manipulate the SharePoint rest api to get this working with no luck so far. I know it is possible I figure I just need some help to make it happen!
You will create the workflow on the project list on the main site. And to start of with I think you will first have to populate a multiline variable through the Build string action. with this code
<Batch OnError="Continue" ListVersion="1" >
<Method ID="1" Cmd="New">
<Field Name="Company contact Person">Joe Bloggs</Field>
<Field Name="Company Project Name">New Hardware</Field>
And you should add the right field names as it is in the TARGET list of the company and replace the hardcoded text, i.e. TestABC with a variable for Company name and Contact Person with the variable for the contact person, etc.
You can also add more fields to the list by adding a <Field Name="TargetListFieldName">variable</Field>. It should look something like this.
The next step would be to call the webservice. The URL should point to the site where the target list is, I.e.
Then add the listname from the variable as well as the Updates created in the build string action
That should be sufficient to get this dynamically created.
Let me know how it goes.
Looks like I got this working with a variable in the URL! Thank you! Now it is sending to the right subsite depending on the Customer name.
Each time it runs it creates a new item on the subsite which covers creating new items on the list. Now if I want to make it so also if I modify an entry on the original list, it gets pushed to the subsite and updates the entry there instead of creating a new list item?
Also I noticed, based on the code above I thought items on the new list would be created with the same ID and they are not, which is making it hard to do an update on the items. My Primary list item is at ID=25 for example, but when it creates an item on the new list it's ID=5 (only 5 entries there so far) meaning I can't run an update like:
<Batch OnError="Continue" ListVersion="1" >
<Method ID="1" Cmd="Update">
Because it would be looking for a list entry with the ID of 25 (from the primary list).