Linking Multiple Assets to an Incident
The current version of Help Desk (as of this writing) allows you to select a single asset, and set it as the 'managed object' for that incident. This comes in handy for reporting and automation rules, not to mention the ability to quickly navigate to the resource manager, or carbon copy to a device via the icons next to the selected asset. In my workplace however, our day to day workflow requires that for a given incident, multiple assets need to be associated.
To that end, I created a mechanism that allows the linking of multiple assets to an incident with a bare minimum of customization to the help desk product.
Tested Using:
Altiris HelpDesk Solution 6.0.308
Altiris Asset Management Solution 6.5.1126
Altiris CMDB 6.5.1126
I would preface this by stating that this solution requires a solid understanding of the resourceassociation table within Altiris. Not a complicated thing, but you can certainly cause a lot of problems if you mess it up.
In order to minimize the amount of customization, and reduce the overall complexity, our approach leverages the resourceassociation table in Altiris to store the link data. Using the same (and existing) architecture used to associate (link) all other resources to one another, the actual customization to help desk is limited to one line of code inserted in a single help desk template.
* To undo the customization then, you just delete one line of code, and a single resourceassociation type, and boom! ...you're right back where you started.
Our approach for linking multiple assets requires three components:
- A Resource Association between an incident and an asset
- A hyperlink within help desk worker view that passes the guid of the current incident to a custom web page.
- An in-house built web page that displays associated assets, and can make new or delete existing associations.
The first is a piece of cake. In the configuration tab of the Altiris console, expand the resource settings, and then the resource associations container. In the user defined folder of your choice (I put ours under asset association types/user defined), create a new resource association by right clicking the parent folder, and selecting new->editable association type:
Name the new association, and select the 'from' and 'to' resource types as 'asset' and 'incident' respectively. Set the cardinality (the number of allowed/required associations per resource) as appropriate, choose the resource pickers you want to use, and save your new association type.
The order in which you do the second and third steps is up to you, but for the web site to function it needs a starting point. That is, it needs to know with what incident to contextualize its queries. So then, what is needed (the only real customization required by this approach), is the creation of a hyperlink within the helpdesk worker view that when clicked, passes in the identifier of the incident from which it was clicked to a web page. To create the link, we need to create a custom version of the subworkitemeditgeneral.ascx file located in the templates folder (usually C:\Program Files\Altiris\Helpdesk\AeXHD\templates). Editing this template will make changes to the appearance of the body of an incident in edit mode only. Changing the appearance in any other mode would require that you edit its respective template file.
If you have done any customization to help desk, I don't need to tell you this part, but DON'T edit this file directly. Create a folder called 'custom' in your Altiris aexhd folder (usually C:\Program Files\Altiris\Helpdesk\AeXHD\), and a sub folder within it called 'templates' like so: C:\Program Files\Altiris\Helpdesk\ AeXHD\custom\templates. Make a copy of subworkitemeditgeneral.ascx, put it in your \custom\templates folder, and rename it to customsubworkitemeditgeneral.ascx. You may also need to make a copy of other files and put them in this folder as well (like TemplateEngine.inc) to get this working. Certainly, I have more files in my folder than I need to do just this customization, but then this is not the only customization we have. My custom folder looks like this:
You will notice that I have prepended 'custom' to all of the .ascx files. Certainly, there are more in-depth/better explanations on how to set up custom help desk templates to be used, but in the interest of reduced digression we will keep them out of scope here. However, one key step I will touch on is the creation/modification of a custom.config file which tells help desk to start using your custom templates instead of the originals. See the product release notes (altiris kb 18269) for more info. My custom.config file is located in C:\Program Files\Altiris\Helpdesk\AeXHD\worker, and looks like this:
<?xml version="1.0" encoding="utf-8" ?>
<custom.configuration>
<files path="~/custom/templates/">
<file id="WorkItemEdit" file="customWorkItemEdit.ascx"/>
<file id="WorkItemView" file="customWorkItemView.ascx"/>
<file id="subWorkItemEditGeneral" file="customsubWorkItemEditGeneral.ascx"/>
<file id="subWorkItemEditAsset" file="customsubWorkItemEditAsset.ascx"/>
<file id="subWorkItemEditAttach" file="customsubWorkItemEditAttach.ascx"/>
<file id="subWorkItemEditBulletin" file="CustomsubWorkItemEditBulletin.ascx"/>
<file id="subWorkItemContact" file="customsubWorkItemEditContact.ascx"/>
<file id="subWorkItemEditEmail" file="customsubWorkItemEditEmail.ascx"/>
<file id="subWorkItemEditFindAsset" file="customsubWorkItemEditFindAsset.ascx"/>
<file id="subWorkItemEditFindContact" file="customsubWorkItemEditFindContact.ascx"/>
<file id="subWorkItemEditLink" file="customsubWorkItemEditLink.ascx"/>
</files>
</custom.configuration>
So then, open the C:\Program Files\Altiris\Helpdesk\AeXHD\ custom\templates\customsubWorkItemEditGeneral.ascx file, and search for a place to insert the link. I have opted to have the link appear as an icon next to the others to the right of the existing 'Asset:' field:
It can be tricky to find a place to put your link, but to put it where I did, search for the text string 'ibSelectAsset' (you will find only one instance). Skip to the end of the line, and press enter to insert a new one.
Enter the following line of text (include the URL to your web page):
<aw:HyperLink id="mylink" ImageUrl="icnLink" runat="server" target="_blank" NavigateURL='<%# "http://URL TO MY WEB PAGE" + datastore("WorkItem").current("_resourceguid") %>' Enabled='True' />
Save, and close the file. The way this is set up, the URL you insert will be appended with a string containing the resource guid of the incident. This gives your web page the context it needs to run its queries, so structure your web page/URL so that the guid at the end becomes a parameter for your page. The id="mylink" portion is arbitrary, but the value needs to be unique from any other id on the page. The ImageUrl="icnLink" tells it to use the icon you see in the image above, but you can point it to whatever icon you like.
If this is your first customization, you may need to perform an IIS reset (once you have created/modified custom.config) to make help desk start using the templates in your custom folder.
Finally, step three. The web page is really all up to you, but the basic concept is that when the page loads, it takes the guid passed in from help desk, and queries the Altiris database to find all the assets associated to the incident from which the link was clicked. From there, it is easy to add the 'add' and 'remove' functionality by writing the insert and delete queries and binding them to triggers/forms on your web page. Mine looks like this:
In my page, I have also added the ability to assign (link or associate) the asset with the primary contact in the incident. Additionally, as in the case above, when an asset request generated the incident, it affords me a way to query for the cost center (expense account) that was used during the request and so too to be able to associate the asset to that cost center for billing. You could just as easily perform these (and any other) additional functions via an automation rule or smart task utilizing an AEXQUERY once the asset(s) has/have been associated to the incident. The barcode field is a hyperlink to the resource manager for that asset. As of this writing, I have not yet added links to carbon copy and/or RTSM but it is entirely possible.
As I mentioned earlier, the resource association(s) store the link data. For each asset that is linked to an incident, a row is added to the resourceassociation table containing the unique identifier of the resource association type, the unique identifier of the asset, the unique identifier of the incident, and a time stamp. The insert statement looks like this:
INSERT INTO resourceassociation VALUES(<RESOURCE ASSOCIATION GUID>, <ASSET GUID>, <INCIDENT GUID>, getdate())
Bear in mind that the asset and incident guids may need to be reversed depending on whether you put asset or incident in the 'from type' field when you created your resource association. The above is correct if you created yours the same as mine.
- Login or register to post comments
- 1960 reads
- Printer-friendly version



















Perfect timing.
We were just considering doing this exact thing for our helpdesk as we're replacing a legacy system. I'm thinking I'm going add this to our project.
Thanks!
Insert Bonus
While you should avoid making direct inserts into the altiris database whenever possible, sometimes there's just no way around it. However when you must, it is always best to use the library of stored procedures that get 'installed' along with the various altiris products whenever you can. Instead of the above insert statement for creating a resource association, try using the spAddAssociation function like this:
spAddAssociation(<resourceassociationtypeguid>, <parent guid>, <child guid>)