0

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)?

B. Clay Shannon-B. Crow Raven
  • 8,547
  • 144
  • 472
  • 862
  • 1
    I don't quite understand what value you would derive from accessing the list by its GUID instead of by its title, after first accessing it by its title. It seems to me like what you'd really want is the ID of the list **item** that you create on the first page so you can retrieve it and update it on subsequent pages. Am I misunderstanding? – Thriggle Oct 09 '15 at 14:52
  • I'm probably misunderstanding what "title" means; I'm viewing it as analagous to a table name. So for the table/list named "PostTravelFormFields", there will be many "records" within it, some of which have "bla" as their ListID (perhaps a GUID) value, which ties them together, others having "blee". So all the "records" with "bla" belong together, etc. – B. Clay Shannon-B. Crow Raven Oct 09 '15 at 16:35

0 Answers0