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.
Masked type variable usage for Service Catalog - Support and Troubleshooting
  • >
  • Knowledge Base
  • >
  • Support and Troubleshooting (Knowledge Base)
  • >
  • Masked type variable usage for Service Catalog
KB0681163

Masked type variable usage for Service Catalog


13754 Views Last updated : Aug 24, 2022 public Copy Permalink English (Original)
  • English (Original)
  • Japanese
KB Summary by Now Assist

Issue

The Masked type variable in Service Catalog is used for storing sensitive or confidential information. (Note that although these variables are encrypted, they are not related to Encryption Support.) This article describes how to use and decrypt them. In order for the variable to be encrypted, you must check "use encryption" in the "type specification" tab of the variable, otherwise, the variable will be in plain text within the HTML source, and stored in plain text.

For more information about Masked variables, see the product documentation topic Variable types

Masked type variable setup

If you are using a Masked type variable for a catalog item, you would also create another variable of type Single Line Text. The Masked variable (named "A") will be shown in catalog item and request item records. The Single Line Text variable (named "B") will be hidden at the catalog item record but shown in the request item record so that the user can enter confidential information.

To decrypt Variable A and populate the values to Variable B running on the Request Item table, you would create a Before Insert or Update business rule. Create a business rule with the following parameters:

Name: Name of the business rule

  • Table: sc_req_item
  • Active: True
  • When: Before
  • Insert: True
  • Update: True

In the Advanced tab:

  • Condition: current.cat_item == <sys_id of the catalog item>
  • Script:
    (function executeRule(current, previous /*null when async*/) { 
    // Add your code here
    current.variables.B = current.variables.A.getDecryptedValue(); //current.variables.<variable name>
    })(current, previous)

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.