function ShowPopup() {
        var options = SP.UI.$create_DialogOptions();
        options.width = 800;
        options.height = 600;
        options.allowMaximize = false;
        options.url = "https://sitename.sharepoint.com/samplepoc/Lists/Announcements/DispForm.aspx";

    type: 'GET',
    headers: {
       'accept': 'application/json;odata=verbose'
    url: '/samplepoc/_api/web/lists/getbytitle(\'Announcements\')/items',
    success: function(data){    
        var info = data.d.results;
        announce(info.pop(), '#leftboxmain');
        announce(info.pop(), '#leftboxleft');
        announce(info.pop(), '#leftboxright');


var announce = function(item, location){
    $(location).append('<h2>' + item.AnnouncementDate + '</h2><h3><a href="javascript:ShowPopup();">' + item.Title + '</a></h3>' + '<div class="anntext">' + item.Body + '</div>');

Above is the code I currently have - Basically what is happening, is that each time a new announcement is created the dashboard updates. I would like the title to open a modal with that announcements display form showing.

Given the fact this will be constantly updated, I can't include a URL with a specific ID - so my question is whether there is a way to link each announcement with it's own display form or if there is another method I could try?

I hope this makes sense - I'm sort of learning as I go with SP Designer so if I need to clarify anything please do let me know.


If you want the announcements to pop up in real time you need to poll the list at intervals and take action whenever a new one shows up. The function you're looking for is setInterval - I suggest looking into documentation on that.

You also need to figure out when a new item shows up, so you'll need to store the ID of the newest item found on page load in a variable. When you fetch announcements in your loop, check to see if you've got an ID higher than that value. If so, you've found a new one, and you can show it. Be sure to update your highest ID variable when you do this.

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.