Asset - Installed on?

Greg42
Mega Guru

Hi All,

I'm creating a view for assets and want to add similar tab CI have which shows installed software. The closest I got with out of the box option was adding software packages(cmdb_ci_spkg) to related list but that won't show anything as it on its own has a related list of CIs from cmdb_software_instance table. I have added a reference to assets on cmdb_software_instance table and now I can see installed software in my assets. It feels a bit wrong as now I will have to amend all the scripts that insert to cmdb_software_instance table to acknowledge assets.

Am I overcomplicating it and there is an easier maybe out of the box way to display installed software on assets? I am wondering if I should leave asset view with options as it is and point users to CIs if they want that information?

Cheers

Greg

1 ACCEPTED SOLUTION

Community Alums
Not applicable

Greg,



To do this, you want to create a Defined Related Lists - ServiceNow Wiki. I apologize for the wiki link rather than a newer link on the Docs site, but I was unable to find one. Here are some quick directions, though. I tried this and it worked great.


  1. Navigate to System Definition > Relationships.
  2. Click New.
  3. Complete the form as follows:
    1. Name: Software Installations to Asset (or a descriptive name of your choice)
    2. Applies to table: Hardware [alm_hardware] (I used this because it really should only apply to hardware assets)
    3. Queries from table: Software Installation [cmdb_sam_sw_install] (note: this table is only available if you are working with Software Asset Management, otherwise you should select Software Instance [cmdb_software_instance])
    4. Query with:


(function refineQuery(current, parent) {



  // Add your code here, such as current.addQuery(field, value);


  current.addQuery('installed_on',parent.ci);



})(current, parent);



The template is there, so you only need to add line 4 from this javascript.



Save this record. Then you should be able to select the related list on your Hardware Asset form with the name you identify in Step 3 above.



Good luck!


Ben


View solution in original post

2 REPLIES 2

Community Alums
Not applicable

Greg,



To do this, you want to create a Defined Related Lists - ServiceNow Wiki. I apologize for the wiki link rather than a newer link on the Docs site, but I was unable to find one. Here are some quick directions, though. I tried this and it worked great.


  1. Navigate to System Definition > Relationships.
  2. Click New.
  3. Complete the form as follows:
    1. Name: Software Installations to Asset (or a descriptive name of your choice)
    2. Applies to table: Hardware [alm_hardware] (I used this because it really should only apply to hardware assets)
    3. Queries from table: Software Installation [cmdb_sam_sw_install] (note: this table is only available if you are working with Software Asset Management, otherwise you should select Software Instance [cmdb_software_instance])
    4. Query with:


(function refineQuery(current, parent) {



  // Add your code here, such as current.addQuery(field, value);


  current.addQuery('installed_on',parent.ci);



})(current, parent);



The template is there, so you only need to add line 4 from this javascript.



Save this record. Then you should be able to select the related list on your Hardware Asset form with the name you identify in Step 3 above.



Good luck!


Ben


Ha! Thank you very much Ben for detailed answer. Works like a charm.




Cheers



Greg