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?

1 Answer 1


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. Commented Dec 4, 2015 at 23:44
  • Add a javascript file to your page or paste the code in a script editor.
    – Keerthi
    Commented Dec 7, 2015 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' Commented Dec 14, 2015 at 19:14
  • listId is picking up the list though, the debugger shows listId = "{695209AE-4D15-433B-8EAF-A8AE9679962E}" Commented Dec 14, 2015 at 19:17
  • 1
    Solution works , but you need to get the context first: var ctx = SP.ClientContext.get_current(); Commented Dec 17, 2015 at 18:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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