Skip to page contentSkip to chat
ServiceNow support
    • Community
      Ask questions, give advice, and connect with fellow ServiceNow professionals.
      Developer
      Build, test, and deploy applications
      Documentation
      Find detailed information about ServiceNow products, apps, features, and releases.
      Impact
      Accelerate ROI and amplify your expertise.
      Learning
      Build skills with instructor-led and online training.
      Partner
      Grow your business with promotions, news, and marketing tools
      ServiceNow
      Learn about ServiceNow products & solutions.
      Store
      Download certified apps and integrations that complement ServiceNow.
      Support
      Manage your instances, access self-help, and get technical support.
How to use $sp.logStat in a Scoped Application widget -
  • >
  • Knowledge Base
  • >
  • Support and Troubleshooting (Knowledge Base)
  • >
  • How to use $sp.logStat in a Scoped Application widget
KB0696859

How to use $sp.logStat in a Scoped Application widget


2869 Views Last updated : Jul 24, 2025 public Copy Permalink
KB Summary by Now Assist

Issue

$sp.logStat is a call used to create a new entry in the sp_log table with a table name, a record sys_id from that name, and some type and optional comments. Handy for doing things like logging searches or visits to pages, etc.

This call exists on the OOB widget "KB Article Page", however when cloning this widget and assigning the new widget to a Scope Application, this call doesn't work anymore. The reason is that the call is unable to retrieve the correct data due to it now being in a Scoped Application.

Procedure

If you're doing a GlideRecord call and you're using this to call in data from elsewhere, you need to ensure that you're using a get call such as getValue as shown in these examples:

Global Application Scope

$sp.logStat('Kb Article View', "kb_knowledge", articleGR.getUniqueValue(), articleGR.short_description);

Non-Global Application Scope

$sp.logStat('Kb Article View', "kb_knowledge", articleGR.getUniqueValue(), articleGR.getValue('short_description'));
The differences would be in the last call, where we are now using getValue, instead of dot-walking directly to the short_description field.

The world works with ServiceNow.

Sign in for more! There's more content available only to authenticated users Sign in for more!
Did this KB article help you?
Did this KB article help you?

How would you rate your Now Support digital experience?

*

Very unsatisfied

Unsatisfied

Neutral

Satisfied

Very satisfied

Very unsatisfied

Unsatisfied

Neutral

Satisfied

Very satisfied

What can we improve? Please select all that apply.

What are we doing well? Please select all that apply.

Tell us more

*

Do you expect a response from this feedback?

  • Terms and conditions
  • Privacy statement
  • GDPR
  • Cookie policy
  • © 2025 ServiceNow. All rights reserved.