Catalog UI policies and catalog client scripts set to Applies on Requested Items or Applies on Catalog Tasks can fail when a write-role has been specified on the variable and a user views the record while logged in as (impersonating) a user that fails the role check.

Steps to Reproduce

  1. Navigate to one of the following:
    • Self-Service > Service Catalog 
    • Service Catalog > CatalogHardwareSales Laptop
  2. Personalize the Additional software requirements variable and give it a name (for example, software_requirements).
  3. Update the Write roles field and add admin.
  4. Create a Catalog UI policy.
  5. Go back to the item, right-click the header, and select Personalize UI Policies.
  6. Create a policy with the following values:
    • Short Description: Hide software requirements
    • On load: true
    • Active: true
    • Applies on a Catalog Item view: true
    • Applies on Requested Items: true
    • Applies on Catalog Tasks: true
    • Actions:
      • Name: software requirements
      • Read only: Leave alone
      • Mandatory: Leave alone
      • Visible: False
  7. Create a request for a Sales Laptop.
  8. Impersonate a non-admin user, such as ITIL User.
  9. Go back to the item and make the request. 
  10. View the request.
    If you are already impersonating the ITIL user, navigate to Service Catalog > Items.
  11. Open the item for the request.
    Note that the Additional software requirements variable is visible and the JavaScript console shows this error:

    Uncaught TypeError: container.getAttribute is not a function


Create an onLoad catalog client script that applies only to RITM and Catalog Task (not on the catalog item). Then, add code similar to one of the following examples in the script.

For Geneva Patch 4 and earlier versions:

var isAdmin = g_user.hasRole('admin');
if (!isAdmin)
    $j('div[id^=label_ni\\.VE]').parent().attr('name', 'checkbox_container');

For Geneva Patch 5, Geneva Patch 6, and Geneva Patch 7:

var isAdmin = g_user.hasRole('admin');
if (!isAdmin)
    $j('[name=checkbox_container_label]').filter(function() {
         return this.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.getAttribute('name') != 'checkbox_container';


Related Problem: PRB664557

Seen In

Eureka Patch 11 Hot Fix 2
Eureka Patch 13
Fuji Patch 10
Fuji Patch 11
Fuji Patch 12 Hot Fix 1
Geneva Patch 3
Geneva Patch 3 Hot Fix 1
Geneva Patch 3 Hot Fix 2
Geneva Patch 4
Geneva Patch 4 Hot Fix 2
Geneva Patch 5
Geneva Patch 6
Geneva Patch 6 Hot Fix 2
Geneva Patch 7
Geneva Patch 8
Helsinki Patch 0 Hot Fix 1
Helsinki Patch 1
Helsinki Patch 2
Helsinki Patch 2 Hot Fix 2
Helsinki Patch 5

Fixed In

Geneva Patch 8
Helsinki Patch 1

Associated Community Threads

There is no data to report.

Article Information

Last Updated:2017-06-29 18:14:33