UI Policy and Client Script not working on "Ticket Form" [ticket] page on Service Portal


A Catalog UI Policy or a Catalog Client Script to hide a catalog item variable do not work on the OOB "Ticket Form" [ticket] page on Service Portal.


Steps to Reproduce


  1. Navigate to Maintain Items > Apple iPad 3
    • /nav_to.do?uri=pc_hardware_cat_item.do?sys_id=060f3afa3731300054b6a3549dbe5d3e
  2. Create a New Variable "SP Test"
    • /nav_to.do?uri=item_option_new.do?sys_id=d89ed5b913047200efffb6004244b00b
      Type: Single Line Text
      Question: This variable is hidden by UI Policy
      Name: sp_ui_policy_test
      Default Value: This field should not be visible
  3. Create a Service Catalog UI Policy
    • /nav_to.do?uri=catalog_ui_policy.do?sys_id=035fddb913047200efffb6004244b0ea%26sysparm_view=advanced
      Applies to: A catalog Item
      Condition: none
      Applies on a Catalog Item view: true
      Applies on Catalog Tasks: true
      Applies on Requested Items: true
      On load: true
      Reverse if false: true
  4. Create a UI Policy Action to hide variable
    • /nav_to.do?uri=catalog_ui_policy_action.do?sys_id=31ff19f913047200efffb6004244b012%26sysparm_view=advanced
      Catalog Item: Apple IPad3
      Variable name: sp_ui_policy_test
      Visible: false
  5. Navigate to SP > Order Something > Apple iPad3 
    • /sp?id=sc_cat_item&sys_id=060f3afa3731300054b6a3549dbe5d3e
      Notice how the variable is hidden as expected:

  6. Submit an order
  7. Navigate to the requested item in the Ticket form [ticket]
    • /sp?id=ticket&table=sc_req_item&sys_id=3640a9f913047200efffb6004244b00c&view=sp
      Notice the variable is not hidden:

Applies to: A catalog item
UI Type: All
Applies on a Catalog Item view: true
Applies on Requested Items: true
function onLoad() {
     g_form.setDisplay('sp_ui_policy_test', false);
The resulting behaviour is the same as the UI Policy, it works on the order something page and outside SP, but not on the [ticket] page.


This is expected behaviour. The widgets on the default "ticket" page (ticket-conversation and ticket-fields) do not include or contain a Form widget, so they can not use Client Scripts or UI Policies. They are simpler widgets to only show information without benefit of those conditional scripts.
As a workaround, to be able to add UI Policies or Client Scripts, use or create another page that makes use of the Form widget. Then UI Policies and Client Scripts will be available.

Related Problem: PRB741358