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.
Open links up in new tabs using Simple List widget in Service Portal - Support and Troubleshooting
  • >
  • Knowledge Base
  • >
  • Support and Troubleshooting (Knowledge Base)
  • >
  • Open links up in new tabs using Simple List widget in Service Portal
KB0752192

Open links up in new tabs using Simple List widget in Service Portal


7377 Views Last updated : May 29, 2025 public Copy Permalink
KB Summary by Now Assist

Issue

This article provides instructions to modify links in a Simple List widget in Service Portal to open in a new browser tab. To accomplish this, the "$window" Angular service is added to the client controller and the link URL is constructed and passed to the $window service with the "_blank" target attribute.

Release

This article uses the Simple List widget available in the Madrid Patch 4 release.

Resolution

The attached XML file (sp_widget_b0308d89205233004e82c59ab19f5b2b.xml) contains the widget complete with the modifications detailed below and can be downloaded and imported into your instance.

  1. Clone the OOB Simple List widget.
  2. Add the $window Angular service.
    • Add "$window" to the parameter list in the main function definition in the Client controller.
    • Assuming the latest OOB version of the widget in Madrid is being used, the parameter list after this change: function ($scope, $location, $rootScope, spUtil, $interpolate, $window) {
  3. Parse the "url" object to build the URL to pass to the $window service.
    • The "url" object contains four properties: id, sys_id, table and view.
    • the "id" property refers to the portal page that is set in the "Link to this page" field in the instance options.
    • The 'sys_id" property is the sysID of the linked record.
    • The "table" property is the the name of the table to which the linked record belongs.
    • The "view" property is the form view value set in the "View" field in the instance options and defaults to "sp".
    • The value of "$location.path()" which returns a forward slash and the portal suffix is prepended to a string formed by combining the values of the "url" object property values.
    • The final string value: $location.path() + "?id=" + url.id + "&table=" + url.table + "&sys_id=" + url.sys_id + "&view=" + url.view
  4. Modify the onClick event function definition.
    • Locate the onClick function definition in the client controller that begins on line 7 and modify the else if condition as follows:
    • This block of script:
        } else if (url && typeof url == "object")
          $location.search(url);
        else {

      becomes:
        } else if (url && typeof url == "object") {
          var newURL = $location.path() + "?id=" + url.id + "&table=" + url.table + "&sys_id=" + url.sys_id + "&view=" + url.view;
          $window.open(newURL,"_blank");
        } else {

 

***Disclaimer: implementing this functionality is considered customization and is not supported by ServiceNow. Use at your own 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?

Attachments

Attachments

  • sp_widget_b0308d89205233004e82c59ab19f5b2b.xml

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.