Report of users without an asset

Alex Macdonel
Tera Expert

I've been tasked to build a report of all users that DON'T have an asset or CI assigned to them.

 

Out of ServiceNow I would export my user table, and my asset table and using a VLOOKUP I would come up with a list of users without an asset.

 

My first impulse is to create a database view of both tables and see where that takes me.

 

What are your thoughts on this, how would you tackle this?

1 ACCEPTED SOLUTION

Community Alums
Not applicable

Hi Alex,



To do this you would need to create a Database View. I actually answered a question very similar to this recently in another forum and am planning to do a blog post, but have not yet had the opportunity. This topic is also covered in the next release of our Asset Management class, as it is a bit of common information that Asset Managers want to report on.



Here are the reasons you need a Database View with a left join for this:


  • You want to report based on users, but the one-to-many relationship here means that the assets point to a user. The user record does not have a direct reference to the assets.
  • The view allows you to merge the tables based on the sys_id of the user matching the assigned_to of the asset so that each match is displayed as a single row.
  • The left join allows all users to display, even if they do not have a corresponding asset, which is vital to the report in this case.

I have an update set, created on Eureka, if you want to take a look at a sample of what I put together in responding to the other question, which was to see all users without an assigned computer. It should give you an idea of what to do.



Here is a screenshot of the Database View I created to do this and the Try It so you can see what columns I selected to display in the view. You can easily create a report that shows where Name is empty to get the information you need.



Please let me know if you have any questions.



Ben



Screen Shot 2014-07-11 at 7.56.46 AM.png



Screen Shot 2014-07-11 at 7.58.36 AM.png


View solution in original post

9 REPLIES 9

Community Alums
Not applicable

Hi Alex,



To do this you would need to create a Database View. I actually answered a question very similar to this recently in another forum and am planning to do a blog post, but have not yet had the opportunity. This topic is also covered in the next release of our Asset Management class, as it is a bit of common information that Asset Managers want to report on.



Here are the reasons you need a Database View with a left join for this:


  • You want to report based on users, but the one-to-many relationship here means that the assets point to a user. The user record does not have a direct reference to the assets.
  • The view allows you to merge the tables based on the sys_id of the user matching the assigned_to of the asset so that each match is displayed as a single row.
  • The left join allows all users to display, even if they do not have a corresponding asset, which is vital to the report in this case.

I have an update set, created on Eureka, if you want to take a look at a sample of what I put together in responding to the other question, which was to see all users without an assigned computer. It should give you an idea of what to do.



Here is a screenshot of the Database View I created to do this and the Try It so you can see what columns I selected to display in the view. You can easily create a report that shows where Name is empty to get the information you need.



Please let me know if you have any questions.



Ben



Screen Shot 2014-07-11 at 7.56.46 AM.png



Screen Shot 2014-07-11 at 7.58.36 AM.png


Ben,



Do you have a link to that update set you've created?   I'd love to see what you've done.


Community Alums
Not applicable

I've posted it to Box. You can access it here: UsersWithNoAssignedComputer.xml - Box.



It is an Update Set that you can import with the Retrieved Update Sets module. Then Preview and Commit if it all looks good. It creates the Database View User and Computer [u_user_computer] and a report (currently configured to be viewable by everyone) called Users with no Assigned Computers. Note, I created this in Eureka, so it may not work on earlier ServiceNow releases.


Great! I'll check it out.



Thanks!