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 getRecord() method works - Support and Troubleshooting
  • >
  • Knowledge Base
  • >
  • Support and Troubleshooting (Knowledge Base)
  • >
  • How getRecord() method works
KB0727764

How getRecord() method works


4208 Views Last updated : Apr 7, 2024 public Copy Permalink
KB Summary by Now Assist

Issue

This document describes the best practices for using the getRecord() method.

Related Links

The signature of getRecord() method is to populate out values from the cache based on session. This method should be used where you are not using the session data but the actual data from the database and which should not be changing based frequently. The method call is used for performance reasons so that the client doesn't have to make frequent calls to server based on the transaction to fetch the data.

It is used when things that need performance/access the user record frequently and ok with not seeing updated info/changes for the duration of a transaction. If the script is fetching the data which is not present in the database using this method, it will return the data stored in the cache. This can result in inconsistency with the data.

 

When not to use getRecord():

  1. In business rules which check for session level data, like gs.getSession() etc.
  2. As a default value in variables, because it might yield inconsistent results, it may return data for another logged in user which is a risk.

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.