Monday, October 16, 2017

Creating the Status Page, Part 1: Powershell

This first part is fairly easy, I created a PowerShell script that runs on the server every morning from Task Scheduler.  All that it does is prepare the SharePoint list with new blank items for the manager to use for each morning's daily entries.

$web = Get-SPWeb -Identity "https://yoursharepointsite"

# SPList name
$list = $web.Lists["Daily Service Review"]
$arr = @("Server","Network","Security","Database","Data Movement","Collaboration","Voice","Monitoring","iSeries/pSeries","EUC","DC Operations")

# Iterate for each list column
foreach ($row in $arr)
{
    $item = $list.Items.Add();
    $item["DSR Color"] = "Grey";
    $item["DSR Letter Grade"] = "-";
    $item["Team"] = $row;
    $item.Update();
}

The column "DSR Date" is a date column in the SharePoint list that defaults to Today's date.
Additionally, I created a specialized input form in SharePoint that displays only those items where DSR Date is equal to [Today].

In the Site Assets library for the site, I have stored several text files for my code.  I use Content Editor Web Parts to add these code snippets to the page.  This first piece creates a button for the manager to click on that brings up the view for input of Today's status.


<script type="text/javascript">
  
function openDialogBox(Url) 
{    
    var ModalDialogOptions = { url:Url, width: 700, height: 580, showClose: true, allowMaximize: true};    
      
    SP.SOD.execute('sp.ui.dialog.js', 'SP.UI.ModalDialog.showModalDialog', ModalDialogOptions);
}
</script>

<div><span class="readmore btn-sm btn-default btn" onclick="OpenPopUpPageWithTitle('https://yoursharepointsite/Lists/Daily%20Service%20Review/Daily%20Entry.aspx#InplviewHash1bfbd8dd-82ed-48a8-ab11-ca9cf5039dd3=ShowInGrid%3DTrue',null,null,null,'Daily Service Review');">Enter Daily Service Grades</span>

<span class="readmore btn-sm btn-default btn pull-right" onclick="openDialogBox('/yoursharepointsite/_layouts/15/listform.aspx?PageType=8&ListId=%7BD760542B%2D4F0E%2D4D97%2DBACF%2D320F912FCFB4%7D')">Enter Daily Ticket Numbers</span></div>


Clicking this button, pops up a window that will look like this:




Each morning the manager takes input from everyone on the morning call in and enters comments and status for each team.  This is saved to the SharePoint list.

Series Links

No comments:

Post a Comment