Open SharePoint Alerts Page Using JavaScript

The page to set up alerts for a SharePoint list requires the list ID to be passed in as a query string. The follow code will get the ID for the list with a specific title. It will  then open the alerts setup page for that list in a SharePoint dialog box.

   1:  var context = new SP.ClientContext.get_current();
   2:  var listTitle = 'TitleOfYourList';
   3:  var list = context.get_web().get_lists().getByTitle(listTitle); 
   4:  context.load(list);
   5:   
   6:  context.executeQueryAsync(function (sender, args) {
   7:      var id = list.get_id();
   8:      NewItem2(e, 'http://yoursite/_layouts/SubNew.aspx?List=' +id);
   9:  });

Print | posted on Friday, March 1, 2013 2:04 PM

Comments on this post

No comments posted yet.

Your comment:

 (will show your gravatar)