Client Management Suite

 View Only

Creating Custom Search for Different Field (Owner) 

Apr 18, 2012 12:45 PM

I needed a way to assign owners to computers, so that our support desk could confidently and quickly look up a computer for a user based on the caller id. I didn't want to trust the primary user or current logged on user data, I wanted to return only assigned computers, in case the user had signed on somewhere else. I didn't the wrong computer to get imaged, and I didnt' want helpdesk to ask for the person's computer name or serial number.

The custom search does have a selectable field, Ownership Details - Owner, but that is a guid field so not useful. I found no fields that contained the owner name in any built in custom conditions.

 

Time to go searching. I saved a test query called "By Last Logged on User", and searched the item database for it

SELECT * FROM ITEM WHERE NAME LIKE '%By Last Logged on User%'

 

From there, I saw there was some XML definition in the State field that I could possibly modify for my needs. It looked like a double join may not have been possible, so I went looking for a view that contained the owner name using just one join, and I found vAssetUserOwner.

 

Next, I parsed the xml from the custom search's State field in the item table to figure out what I needed to construct. This is what I came up with:

<join sourceName="vAssetUserOwner" onOriginField="Guid" onThisField="_AssetGuid" type="INNER"><dataField name="User Name" alias="Owner" select="true" visible="true" scoping="false" /></join>

Needed to be inserted somewhere. I stuck it in between two existing <join> and </join> tags. Also, I changed out the existing filter definition with my own datafield to query against. This is what it ended up looking like

<filters><filter operator="AND" position="0"><expression operator="%LIKE%" position="0"><expression operator="LOWER" position="0"><dataField name="[vAssetUserOwner].[User Name]" position="0" /></expression><value type="Text" position="1">username</value></expression></filter></filters>

 

After constructing my XML, I updated the custom search's xml in the state field in the item table. I did this by

UPDATE ITEM SET STATE = 'my xml goes here' WHERE GUID = 'the guid from the select from item query above, the one i was modifying, goes here)'

Next I checked my saved search. It works, it now will search for the Full Name of the Owner of the computer. Attached is the XML of my saved search, I would suggest that you create a test search, and use that (and that guid) to update with this status code. You should be able to create your own views and modify this XML to allow you to do many other things, such as custom fields or even data that you have coming in from the connector. There are lots of possibilities.

 

 

And as always, you are directly editing fields in the database. Please have a backup and be comfortable with what you are doing.

Statistics
0 Favorited
0 Views
1 Files
0 Shares
0 Downloads
Attachment(s)
txt file
searchbyowner.txt   4 KB   1 version
Uploaded - Feb 25, 2020

Tags and Keywords

Comments

Apr 18, 2012 02:39 PM

You should use Asset Owner (Asset User Owner) in the CMDB.  CMDB is now a feature of CMS so you have the ability to use any of those fields or create new fields (see: http://www.symantec.com/docs/TECH166149).  However from the enhanced views (where you are searching in your screenshot), Asset User Owner is not an option under Resource Association so it makes it more difficult to search in this view.  I will notify the UI team to see if we can get it added.

Related Entries and Links

No Related Resource entered.