I have an Events list here (use date filter for 9 Dec 2015 to get items) http://www.sd72.bc.ca/school/timberline/Pages/Flex_Calendar.aspx

By hitting the leftmost column, I can get a blue tick mark indicating I've selected an item.

I want a button that adds items to a Signup list based on the selected Events:

List: **Signups**
Column: User
Column: Event
COlumn: ...etc

When the user click a button, I want the Signups list to add a new entry for each of the selected items.

How can I do this?


You can get selected items by

var listId = SP.ListOperation.Selection.getSelectedList();
var oList = ctx.get_web().get_lists().getByTitle('list name'); // Put your list name here        
var selectedItems = SP.ListOperation.Selection.getSelectedItems(ctx);

And perform actions using this selectedItems

  • Thanks. Where does this code go? In a Workflow? Sorry, Sharepoint noob here. – 43Tesseracts Dec 4 '15 at 23:44
  • Add a javascript file to your page or paste the code in a script editor. – Keerthi Dec 7 '15 at 14:41
  • Sorry for the late response. When I try this code I get the error Object doesn't support property or method 'get_web' – 43Tesseracts Dec 14 '15 at 19:14
  • listId is picking up the list though, the debugger shows listId = "{695209AE-4D15-433B-8EAF-A8AE9679962E}" – 43Tesseracts Dec 14 '15 at 19:17
  • 1
    Solution works , but you need to get the context first: var ctx = SP.ClientContext.get_current(); – 43Tesseracts Dec 17 '15 at 18:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.