Custom Tasks in the Hardware Asset Form
Hi all,
We're getting to grips with Asset Management within the portal and it's going well, but some of my colleagues are forgetting silly little things, like not setting the HW Asset Status to "Loaned" when loaning out an asset. It got me thinking, the easiest way would be to create one or two custom tasks to add onto the HW Asset form...
The problem is I don't know how to write a single line of Javascript. A necessary requirement for these things sadly.
Wondered if anyone might be able to help in any way, or if anyone had developed custom tasks themselves they might be willing to share?
In my mind, I was thinking of a "Loan Item" custom task that opens a window asking for a user (via user picker), Loan Date and Return Date. Fill all three out and the task could set the Primary User/Custodian, the Loan and Return dates and set the HW Asset Status to Loaned all in one go.
Another idea was something that lets you update the HW Asset Status but also include a comment. The task could take the name of the active user and the current date/time and perhaps append the comment to the Notes tab along with the name and date/time of the commenter.
Best Answers
-
Adam_Dzyacky Product Owner Contributor Monkey ✭✭✭✭✭
The problem is I don't know how to write a single line of Javascript. A necessary requirement for these things sadly.
And to that sir I say, we all start somewhere! But I think there are a couple ways to look at this:
- I typically think of Tasks like some kind of one-off Action that I'm going to take. But it is not a process (several steps) such as - someone approaches me, I give them a laptop, I then push a Task button to update the Primary User and HW Asset Status. To be clear, it's not that you can't do this with a Javascript task but...
- SCSMs bread and butter is process and request fulfillment. I would sooner have a Loaner Laptop Request Offering that invokes a Runbook to perform all my various steps that you outline above. This is a request I would make available to End Users & Analysts so that have 1 process that serves many individuals. Low build time, high ROI.
So again - you can totally go the Javascript task route here. But I personally think it's a bit more effort than it's worth given you have the means to do this with SCSM and the automation tool of your choice (SCO, SMA, or PowerShell Activity).
But if you really want to go the Javascript route over the years I've written a few Javascript tasks that I've listed here in increasing complexity that should help you get started.
- Google It: Add a Task that pops a window to Google something
- View SCOM Alert: Opens an SCSM Incident originating from SCOM in the Microsoft SCOM Portal to view deeper health details. This parses fields on an Incident page to dynamically build a URL to navigate to.
- Search Knowledge Base: If you're on an Incident this will grab the Title, run a Portal Knowledge Base search, and then show the results in a new Tab as though you initially started with a KB search.
- Drawer Tasks: This creates wholly custom buttons and actions on a Grid View that invoke bulk actions on Incidents, Service Requests, Problems, and Changes
While the last example isn't a Task per se, it has a whole lot of code that performs actions behind the scenes against a Work Item.
1 -
Geoff_Ross Cireson Consultant O.G.
Further to Adams suggestions, checkout the 4 part Asset Management Webinar series. One of the sessions pretty much covered exactly this but the example was deploying, rather than loaning.
The videos and code is linked here.
I agree a task is a one off action, but that action could be a set of repeatable steps. The advantage of a task, is that we are already in the context of the specific HWA. The Portal already has one such example for Dispose Asset where it asked for the Ref and sets the status, disposal date and disposal ref.
Geoff
1
Answers
The problem is I don't know how to write a single line of Javascript. A necessary requirement for these things sadly.
And to that sir I say, we all start somewhere! But I think there are a couple ways to look at this:
So again - you can totally go the Javascript task route here. But I personally think it's a bit more effort than it's worth given you have the means to do this with SCSM and the automation tool of your choice (SCO, SMA, or PowerShell Activity).
But if you really want to go the Javascript route over the years I've written a few Javascript tasks that I've listed here in increasing complexity that should help you get started.
While the last example isn't a Task per se, it has a whole lot of code that performs actions behind the scenes against a Work Item.
Hi @Matt_Overton
Further to Adams suggestions, checkout the 4 part Asset Management Webinar series. One of the sessions pretty much covered exactly this but the example was deploying, rather than loaning.
The videos and code is linked here.
I agree a task is a one off action, but that action could be a set of repeatable steps. The advantage of a task, is that we are already in the context of the specific HWA. The Portal already has one such example for Dispose Asset where it asked for the Ref and sets the status, disposal date and disposal ref.
Geoff
Thanks both, this is very helpful. I've had a play around with the CustomSpace idea for HardwareAsset.js but not having much luck. The action of simply copying HardwareAsset.js into CustomSpace is enough to break the Model and Manufacturer enumerations and that's before I've even made any edits so I've shelved the idea for now and will just make do. I'll look into it again in the new year when I've got more time spare.