Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Viewed Service Portal pages

adilbelahbib
Kilo Expert

Hi,

I'm trying to use the Service Portal Log (sp_log) table to create a report showing how many times a page was consulted.

My pages contain a widget that dynamically load some content based on a sys_id parameter.

That's working fine, but it only counts the number of time a widget has been called independently of its content.

Example : myinstance.service-now.com/myPortal?id=myWidget&sys_id=123456789987654321

All what Service Portal Log catches is how many times myWidget was called. But I'd be more interested to know how many time the sys_id was called.

Hope that I had made myself clear.

Thankfully !

2 REPLIES 2

Erik Stolberg
Tera Guru

Within the sp_log table, entries of Type "Task View" or "Catalog View" or "Catalog Request" (for example) all populate the ID field, which is the "sys_id" you specified.



Within the widgets, this is the line that does the logging:


$sp.logStat('Catalog View', data.sc_cat_item.sys_class_name, data.sys_id, data.sc_cat_item.name);



You can create a report that filters Type="myWidget" and then group by ID (although I would group by the Text field as it's more user-friendly).


Thanks Erik,



Yes, I had noticed what you mentionned, but unfortunatly our logs are of the "Page view" type, the one that doesn't fill the ID field.



We developped a simple widget that inserts manually in the sp_log table, and it works.



Thanks again !