Your company assets are key to the success of your organization. This may be either mobile equipment (like the image shown below) or stationary equipment like CNC machines, punch press, printers, agitators, or whatnot. You want to know when they were bought, for how much, where they are and a host of other details that your ERP system may not be able to support. In addition to the asset, you also like to use SharePoint to track maintenance and get reminders of when service is coming due. You want that maintenance time and date stamped and would like to know who did it. You want to ensure that maintenance is being done on time and that there is a record of the activity; who and when. You also want to know how to do that in SharePoint; then this article is for you.
SharePoint has many of the tools right out of the box to do this. A simple assets list with a “Maintenance” column that is set to “Append Changes to Existing Text” will provide an ongoing time and date stamped record every time its edited. This will work, but it will create an entry anytime the asset itself is edited and your “Maintenance” column may become unduly long. What to do?
Link your “Assets” list to your “Maintenance” Lists
What we will do is create a list, lets call it “Assets” then create another list called “maintenance” and link the two together such that when a user clicks “Record maintenance activity” it will open our maintenance list to record our actions.
One way to do this is this is through a two scripts; one that passes the ID or our parent and the other that creates a new maintenance record with the ID of the parent asset. This makes the user experience between the master and detail forms seamless.
(Another method is to create a workflow that triggers the recording of a maintenance activity against the asset. I’ll save that for another blog or contact me and I’ll show you how.)
http://www.sharepointhillbilly.com/Lists/Posts/Post.aspx?ID=26
Thanks to Mark Rackley for popularizing this technique
<!--
Name: dispParent.js
-->
<script type="text/javascript" src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.7.2.min.js"></script>
<script type="text/javascript">
jQuery(document).ready(function($) {
//get the ID for the Issue from the Query String
var issueID = getParameterByName("ID");
//find the element with the "Add new item" link.
//note that if you have more than one list on your page, this just finds the first one
//var anchorElement = $("a[title='Add a new item to this list or library.']");
var anchorElement = $("a:contains('new item')");
//modify the "Add new item" link to call the "NewItem2" function and pass in the Issue ID.
//Be sure to put the path to your site below. You can use relative URL to the web application or the FQDN
$(anchorElement).attr("href","javascript:NewItem2(event,'http://site/mysite/test/Lists/RecItems/NewForm.aspx?IssueID=" + issueID + "&Source=http://site/mysite/test/Lists/RecLog/DispForm.aspx?ID=" + issueID + "');");
//remove the "onclick" attribute from the anchor element as we aren't using it anymore
$(anchorElement).removeAttr("onclick");
});
// The following function should really be put into a utility library
// with all of your commonly called functions
//
// no, I didn't write this function from scratch, I found it at
// http://stackoverflow.com/questions/901115/get-query-string-values-in-javascript
function getParameterByName(name)
{
name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]");
var regexS = "[\\?&]" + name + "=([^&#]*)";
var regex = new RegExp(regexS);
var results = regex.exec(window.location.href);
if(results == null)
return "";
else
return decodeURIComponent(results[1].replace(/\+/g, " "));
}
</script>
<!--
Name: newChild.js
<script type="text/javascript" src="http://site/mysite/SiteAssets/jquery-3.1.1.slim.min.js"></script>
-->
<script type="text/javascript" src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.7.2.min.js"></script>
<script type="text/javascript">
jQuery(document).ready(function($) {
//get the Issue ID from they query string
var issueID = getParameterByName("IssueID");
//Set the corresponding Lookup field value to the Issue ID
$("select[title='Issue']").val(issueID);
//use this line to disable the lookup field selection
$("select[title='Issue']").attr('disabled','disabled')
//use this line to hide the lookup field and label entirely
//$("select[title='Issue']").closest("tr").hide();
});
// no, I didn't write this function from scratch, I found it at
// http://stackoverflow.com/questions/901115/get-query-string-values-in-javascript
function getParameterByName(name)
{
name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]");
var regexS = "[\\?&]" + name + "=([^&#]*)";
var regex = new RegExp(regexS);
var results = regex.exec(window.location.href);
if(results == null)
return "";
else
return decodeURIComponent(results[1].replace(/\+/g, " "));
}
</script>
If we want to improve the usability of this assets tracking system, lets expand it to include both Scheduled and Unscheduled maintenance (or Planned and unplanned if you will).
The above technique just records our unplanned maintenance activities. What if we are more progressive and don’t just fix things when they break but have a regular schedule of activities that apply to a piece of equipment that recur on a daily, weekly or monthly or longer basis? That’s very common; it may be scheduled oil changes, cleaning, filter replacements, belt replacement, fixture replacement, tire change, tool change, etc.
To do this we add an additional “Calendar” web part to this list. The calendar lets us add both one time events and recurrent events, such as oil changes, filter changes, NDT inspections, service plans, cleaning, etc.
We then add a lookup column in our “Calendar” list, or we’ll call it our “Planned Maintenance schedule” from our “assets list”.
Once we have activities added to our planned maintenance schedule, we can have them appear in our Outlook calendar;
Our Assets tracking system now has recordings of both planned and unplanned maintenance activity has the standard time and date stamp as well as the logged in user.
Turn version tracking and your are ready for any maintenance audit to come your way.
These techniques have helped organizations meet ISO 9001 quality system requirements, government safety audits, ISM code audits, EMS audits, IATF 16949, customer audits and just about any other audit requiring tracking of who, what, when and where.
Leave A Comment