copy item and update item action with variable target list names

  • 28 January 2016
  • 7 replies
  • 2 views

Badge +4

Hi Nintex Community,

I have a master list managing project data () for various units. Items created or updated in the master list need to be copied (or updated) to the corresponding units list.

Now the Copy Item action as well as the Update Item action do not allow choosing the target list dynamically based on the unit information.

What is the easiest way to copy or update items to the units list?

Thanks

Thomas


7 replies

Badge +6

Hi Thomas,

You should be able to use the "Copy to Sharepoint" and "Update Multiple Items" controls to do this. Both allow you to pass in the url for the destination.

Cheers,

Mark

Badge +6

Sorry - just realised that the Copy to Sharepoint action needs a Library or folder for destination and I don't believe it takes a list.. My Bad. The Update multiples should still be a valid option, but you may need to call a webservice to action the copy of the item.

Here's a document detailing under what scenario you shou use which control:

Copying items in list/libraries

Cheers,

Mark

Badge +7

Hi,

You can use REST to do both, here's a great article from Caroline Jung on how to do it, How to execute a REST API request with Nintex Workflow. It's got an example of an update.

The following link to Stack Exchange shows a REST copy example, sharepoint online - Copy List items using REST/JSON - SharePoint Stack Exchange

Hope that helps.

Jan

Badge +4

Thanks Mark.

Badge +4

Thanks Jan.

This looks like very advanced stuff. I haven't used Rest so far.

I try to get familiar with it.

I also just got the idea to use a State Machine instead. It might be overkill to achieve what I want but at least I could use the familiar copy and update actions.

Are there any restrictions regarding the number of states? Currently I need 22 states plus initial state.

Correction: no state machine necessary here. A simple switch would do the same.

I give it a try.

Badge +4

Hi Jan.

It turned out that REST API is not available for SharePoint 2010.

Sorry for not being clearer on the SP version.

I was able to use Call Web Service action with Lists.asmx and web method UpdateListItems.

For most of the fields to update (text, number, choice) is was not too hard following this article:
Select list in "Update Item" dynamically

Lookup fields and People/Group fields required some more effort.

Solution for People/Group fields:

Re: Using UpdateListItems doesn't appear to support Person/Group field type

Solution for lookup fields:

http://sharepoint.infoyen.com/2012/03/20/how-to-update-list-items-using-sharepoint-web-service/ 

Still pending is a solution for multiple lines rich text fields.

If anybody has a solution for multiple lines rich text fields it would be nice to post here.

Thanks

Thomas

Badge +4

Solution for multi lines rich text fields:

UpdateListItems Web Service Adds Strange Character to Rich Text Field

<Field Name="Body"><![CDATA[{WorkflowVariable:txtRichText}]]></Field>

Reply