I need to populate a large Sharepoint list (about 100 fields) a several fields/a page at a time (when the user navigates away from a page, store the values he entered on that page into the list).
Rather than six different sets of disjointed/unconnected inserts, though, I want the first page to be an insert (generating a new list ID) and the subsequent "inserts" to be actually updates - adding more data to the existing "record" that bears that list ID.
I start off getting a list this way:
var listGUID;
. . .
function createPostTravelListItemTravelerInfo1() {
var clientContext = new SP.ClientContext(siteUrl);
var oList = clientContext.get_web().get_lists().getByTitle('PostTravelFormFields');
var itemCreateInfo = new SP.ListItemCreationInformation();
this.oListItem = oList.addItem(itemCreateInfo);
listGUID = oList.ID;
// add some field values
oListItem.update();
clientContext.load(oListItem);
clientContext.executeQueryAsync(Function.createDelegate(this, this.onQuerySucceeded), Function.createDelegate(this, this.onQueryFailed));
}
Can I make the second and subsequent "updates" this way:
var oList = clientContext.get_web().get_lists().getById(listGUID);
...that is to say, by using "getById(listGUID)" instead of "getBytitle('PostTravelFormFields')?
Or will I have to break the list up into multiple lists, one per page, and generate my own GUID, and use that throughout the user's session to tie the lists together (ultimately reading from multiple lists that have the same GUID in common in one of their fields)?