Reporting from the Service Catalog – 2 steps giving infinite possibilities…..

General Add comments
by:

Reporting is one of the easiest and most straight forward things to do in Service-now.com. No training needed, just a little understanding and a hint will do.
When you know the ‘shortcuts’, it is really easy to do.
Let me give you an example:

If you are in a list view of a table you want to report on and you have made a query to show what you need, you might want to have that set of data in a report.
Right clicking on the header bar and selecting ‘Pie Chart’ will create a report (a Pie Chart of course).
Now, to enable the report to be saved and edited, simply click the ‘+’ sign on the left top corner and the reporting header will show!
Of course you need to have the correct rights and roles to be able to do this….

In pictures:




 

But that is only showing how easy things can be! There are areas where things are a little more complicated… 😉
A good example would be the result of the following report:

http://wiki.service-now.com/index.php?title=Reporting_on_Service_Catalog_Variables

The link explains how to create a report that will show what has been filled in as answers to the various questions in Catalog Items.
But it is not complete….
The report will not show the values that have been filled in when the Variable is a reference or a slush bucket!


The following approach will help you to add customization to enable the reporting on Reference variables via ‘document_id’ fields (http://wiki.service-now.com/index.php?title=Document_id_Element_Type).

To be able to do this, we need to add two (2) fields and a Scheduled Job to get the correct functionality.
First, we will create the two fields in the Options table (sc_item_option):

  • Field “u_sc_tablename” , type “table_name”;
  • Field “u_sc_displayvalue”, type “document_id”, this will also be the display value. The field should also be dependent

Using a before insert / update business rule to make sure that each time a variable is updated, the correct value will be filled in and you will find that all values are available when you report on the ‘u_sc_displayvalue’ field!


The business rule can look like this:

Table: sc_item_option
Condition: current.value.changes()
When: Before
Update: TRUE
Insert: TRUE
Script:

var type = current.item_option_new.type
if(type == 8 && current.value !=””){
current.u_sc_displayvalue = current.value;
current.u_sc_tablename = current.item_option_new.reference;
}

 

This is enough to get the desired functionality. To make sure that all the variables that have already been created are also updated to reflect a reference value, a background script can be created to update all existing variables.

The condition will make sure that the values will be updated, even if they change later in the process.

Enhancements might be to have also the non-referenced values in the field, so that you can report on all variables via the same field.

Good luck and if you have any questions, don’t hesitate to drop me a mail on: rik.burgering@2e2.nl.

Leave a Reply