Home > Paul Mather, Work > #ProjectOnline PWA Stats with Snapshot #JavaScript #jQuery #PPM #Office365 #PMOT #MSProject

#ProjectOnline PWA Stats with Snapshot #JavaScript #jQuery #PPM #Office365 #PMOT #MSProject

Paul Mather
I am a Project Server and SharePoint consultant but my main focus currently is around Project Server.
I have been working with Project Server for nearly five years since 2007 for a Microsoft Gold Certified Partner in the UK, I have also been awared with the Microsoft Community Contributor Award 2011.
I am also a certified Prince2 Practitioner.

This article has been cross posted from pwmather.wordpress.com (original article)

Want to view simple PWA stats and capture the data to then build simple trend reports? This simple JavaScript and jQuery solution starter might be a good starting point. The output can be seen below:


Each PWA entity can be expanded to see the stats:



Then each week or month etc. you can take a snapshot of the data using the Snapshot button, this creates an item on the snapshot list:


The solution starter code has been published for download. The code expects the SharePoint list to already exist but that is covered in this blog post. The solution starter code can be downloaded from the Microsoft Gallery using the link here: https://gallery.technet.microsoft.com/Online-PWA-Stats-and-eb56e6bb

The code does make use of jQuery and jQuery UI, these are loaded from the jQuery CDN but you might want to download them and store them locally etc.:


The code expects a list called PWASnapshot in the root PWA site collection:


This can be updated to a different target list in the root PWA site collection, just change the listTitle variable as seen above. The following columns are required to already exist on the target SharePoint list in the PWA site collection:


They’re all default column settings apart from DateCaptured, this defaults to Today’s Date. If you do not need the snapshot capability, you could just comment out / remove the snapshot button from the code.

Create a new page on the PWA site to display the PWA Stats data, I created a new web part page in a library called “Pauls” in the root PWA site – this is on my test PWA site, hence a library called Pauls!


Download and update the solution starter as required – remember it is a solution starter so it could do with some code optimisations and better error handling etc. Upload the solution starter JavaScript code to the PWA site, in this example I uploaded it to the same library as the new PWAStats page. Edit the new page and add a Content Editor Web Part, update the Content Link to add the relative URL path for the JavaScript code as seen below in this example:


Update other web part settings as required then click Apply then click OK and stop editing the page.

As the data is loaded, the SharePoint modal dialog will appear:


This will close once all the projects are loaded as on my PWA dataset, the projects data is the largest.

Clicking the snapshot button will also load the SharePoint modal dialog:


This will close when the item is added to the list, then a message will display below the button to state the item has been added:


Trend reports could easily be created using Power BI consuming the snapshot list data to see how the data changes over time.

This could easily be extended to bring in additional PWA stats. I will probably write a blog post in the future to extend this to capture additional PWA stats.

The solution starter file contains HTML, CSS and JavaScript in the same file, for production you might want to split out the HTML, CSS and JavaScript into the separate files, reference the JavaScript and CSS files in the HTML file and link to the HTML file in the content editor web part but as this is so small having one file will be fine and is easier to manage.

Fully test on a DEV / TEST PWA instance first before using in Production. The script is provided "As is" with no warranties etc.

I hope you find it useful Smile

Categories: Paul Mather, Work Tags:
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: