Quantcast
Channel: jQuery Library for SharePoint Web Services
Viewing all articles
Browse latest Browse all 6517

New Post: Creating a new list item using UpdateListItems

$
0
0
Can someone provide information on how to use the UpdateListItems service to create new list items in list "B" from the information entered into list "A"? I am attempting to create a new associate list item based on the details entered into a project list item. The project list item will have details such as title, project ID, assigned resources, etc. I need to create a new associate list item in list "B" for each assigned resource indicated, while reusing the project record data.

List A Example: (Title / ProjectID / Assigned Resources)
Project SP / 1234 / David, Sally, Walter
individual List B Examples:
Project SP / 1234 / David
Project SP / 1234 / Sally
Project SP / 1234 / Walter
Heres a snippet of the code Im using which essentially creates a new list item at PreSave until all assigned resources have been used.

var revisedResources = updatedARvalue.split(";");
var rLength = revisedResources.length
 var singleAR="",i=rLength;
while (i != 0)
{
var singleAR = revisedResources.shift();
$j().SPServices({
    operation: "UpdateListItems",
    batchCmd: "New",
    listName: "{CAC80717-DB02-4140-BF50-0F1EA65CD70A}",      
valuepairs: [["ID",i],["Title",prTitle],["ProjectID",prID],["Assigned_x0020_Resource",singleAR]],
        debug: false,
        completefunc: null 
});
--i;
}

I dont know why this is not working properly; any help is appreciated.

Viewing all articles
Browse latest Browse all 6517

Trending Articles