This project has moved and is read-only. For the latest updates, please go here.

Advice please? Will SPUpdateMultipleListItems do what I would like it to?

Sep 21, 2013 at 8:59 AM
At this stage, this is a design-type question, hence no code attached yet. What I'd be grateful for are some expert views on whether SPUpdateMultipleListItems is able (or best suited) to achieve the following:

I'm in the throes of creating a training booking system within SP Online. My data structure is evolving along the lines of a list of 'skills' with each skills relating to 1 or more 'competencies' in a stored in a separate list but matched using the Skill ID as a lookup.

The use case I am looking to achieve is to have a line manager select an employee, then select a 'Skill' that employee needs to be trained on (all good so far), but then after that selection is made, pull all the competencies relating to the selected skill into a task list of employee skill competencies. Its the function to create those items in the employee skills/competencies list that I think/hope SPUpdateMultipleListItems will achieve for me, but would like a sense-check on this approach given Marc's comments to the poster justinkelly here >>

Am hoping this is not too abstract a question to elicit any responses!

Sep 21, 2013 at 7:17 PM
I think for your use case, the approach in SPUpdateMultipleListItems might make sense. (I just removed those two comments on the docs page because they could be misleading out of context.)

It sounds like you just want to create a set of task items all at once based on a selection. If you dig into SPUpdateMultipleListItems, you'll see that there's nothing magic going on there; it's just a call to get the matching items (if any) and then update what was retrieved. You really want to create a set of items, so you could do roughly the same thing without the first step.

Sep 26, 2013 at 1:13 AM

It's taken me a few days to get back onto this so firstly, thanks for your reply.

Thinking about things and looking at the source code and documentation again, I'm not sure SPUpdateMultipleListItems will do what I'm looking for, at least in its own right (but I'm happy to be told otherwise!).

What I have is a list of Competencies with common field of "Skill" (i.e. one 'Skill' can have many 'Competencies').

In a separate Training Register (list) the user selects a 'Skill' and when that training event is set to "Started" (using a Choice column), I am wanting the code to take the selected "Skill" value in the Training Register item and select the related competencies from the Competencies List and then create task items in an Employee Competencies List to allow training on individual competencies to be tracked. From what I see, I don't think SPUpdateMultipleListItems offers that degree of flexibility (i.e. take a value from list A, read associated list items in list B and create new items in list C), but I'd be happy if it does.

So, what I am thinking I will need to do is use the GetListItems function (to read from list B) and then use the UpdateListItems function (with batchCmd: "New") within the GetListItems' 'completefunc' option to create each task in List C.

Knowing the functions far better than I, can you point me in the better direction?


Sep 27, 2013 at 11:17 AM

Good news. I have achieved what I set out to do by using the combination of GetListItems and UpdateListItems, but if there is greater simplicity offered by the UpdateMultipleListItems, I'd still be pleased to hear.


Oct 3, 2013 at 4:59 PM

In your case, you're probably better off with what you've got.