Skip to main content

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! :-)

I am not sure what the real problem is happy.png

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? happy.png

In the end if you cannot achieve what you want just by using Nintex built-in list actions, you can always use "Web Request" action and just utilize list ‌ to manipulate data in you SharePoint farm.

Regards,

Tomasz


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:

198391_pastedImage_2.png

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.

Kind regards,


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!


Last question - which SharePoint on-premises you are using? 2010, 2013 or 2016?


Hi Drew,

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='ID'>1</Field>

      <Field Name="Company_Name">TestABC</Field>

      <Field Name="Company contact Person">Joe Bloggs</Field>

      <Field Name="Company Project Name">New Hardware</Field>

   </Method>

</Batch>

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.

198478_pastedImage_4.png

The next step would be to call the webservice.  The URL should point to the site where the target list is, I.e.

http://intranet/Projects/Companies/CompanyABC/_vti_bin/lists.asmx

Then add the listname from the variable as well as the Updates created in the build string action

198482_pastedImage_5.png

That should be sufficient to get this dynamically created.

Let me know how it goes.


We are using 2013


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">
<Field Name="ID">{ItemProperty:ID}</Field>
<Field Name="Title">{ItemProperty:Title}</Field>
<Field Name="Test">{ItemProperty:Customer_x0020_Name}</Field>
</Method>
</Batch>

Because it would be looking for a list entry with the ID of 25 (from the primary list).


Great to hear


hi ‌! If you find ‌' answer as correct please mark it and choose as a solution for your question. Thank you.

regards,

Tomasz


Francois Crous‌ any chance you have an idea about the update I wrote above?  ‌ his solution did solve a portion what I was working on which was creating new items on a list on a SharePoint subsite.  Now I am trying to update those items.  I mentioned above I haven't been able to do this yet as the SharePoint list I am sending information to creates an ID that is not identical to the ID on the original list.


Hi Drew!

I've never been using this SOAP method to manipulate lists contents, but looking into wsdl file (../_vti_bin/Lists.asmx?op=UpdateListItems) I can find, that in response you should receive "UpdateListItemResult":

<?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>
    <UpdateListItemsResponse xmlns="http://schemas.microsoft.com/sharepoint/soap/">
      <UpdateListItemsResult>string</UpdateListItemsResult>
    </UpdateListItemsResponse>
  </soap:Body>
</soap:Envelope>

This parameter is a XML formatted value (Lists.UpdateListItems Method (Lists) ) that contains data about every item you have affected by your action:

<Results xmlns="http://schemas.microsoft.com/sharepoint/soap/">
   <Result ID="1,Update">
      <ErrorCode>0x00000000</ErrorCode>
      <z:row ows_ID="4" ows_Title="Title"
         ows_Modified="2003-06-19 20:31:21"
         ows_Created="2003-06-18 10:15:58"
         ows_Author="3;#User1_Display_Name"
         ows_Editor="7;#User2_Display_Name" ows_owshiddenversion="3"
         ows_Attachments="-1"
         ows__ModerationStatus="0" ows_LinkTitleNoMenu="Title"
         ows_LinkTitle="Title"
         ows_SelectTitle="4" ows_Order="400.000000000000"
         ows_GUID="{4962F024-BBA5-4A0B-9EC1-641B731ABFED}"
         ows_DateColumn="2003-09-04 00:00:00"
         ows_NumberColumn="791.00000000000000"
         xmlns:z="#RowsetSchema" />

   </Result>
</Results>

Then you can save the result into a text variable and run "Query XML" against it. Use this xpath, to retrieve all "IDs":

//*@ID]/@ID

This will return you a collection of values:

i"1,Add";"2,Add";"3,Add"] and so on. Each represents affected item. You must then loop through the collection, and for each element replace the ",Add" part of the string, so that you will be left only with the ID of the list item.

After you have this collection of IDs you can then update each element happy.png Or you can do it in the same foreach, when you strip the string from ",Add" part. It's up to you.

Regards,

Tomasz


Reply