Notifications

1948 views

Description

Catalog UI Policies/Catalog Client Scripts are not triggered in Service Portal after clicking the Save button on pages that have the sp-variable-editor widget.

Steps to Reproduce

1. Create a new page in the SPD.

2. Drag and drop the sp-variable-editor widget.
 
3. Create a catalog item with two variables.
    Variable1 --> Select Box   (with choices Yes/No)
    Variable2 --> Single line input
 
4. Create a catalog UI policy (use catalog UI policy action)  for the catalog item such that Variable2 is visible when Variable1 is selected as 'Yes'.
UI Policy Condition: Variable1 is Yes
UI policy action on Variable2: Mandatory: false, Visible: false, Readonly: false
Ensure "Applies on Requested Items" is selected
 
5. Click Try It on the catalog item and create a request. Note the sys_id of the RITM that is created.

6. Create a new Service Portal page with a page_id and include the widget sp-variable-editor in one of the containers on the page.

7. Open the following URL: <instance-name>.service-now.com/sp?id=" rel="nofollow">https://instance.service-now.com/sp?id=<page_id>&table=sc_req_item&sys_id=<RITM sys_id>

At this moment, the catalog UI policy works and Variable2 is hidden if Variable1 is 'yes'.

8. Click the Save button in the variables form.

Variable2 is shown irrespective of value in Variable1. Note that the catalog UI policy/Catalog Client scripts don't work after clicking the Save button.

9. Refresh the page.

Note that you can again see the UI policy, Client scripts are working, and variables are hidden/displayed properly.

Workaround

  1. Open the Form widget (https://<instance-name>.service-now.com/sp_widget.do?sys_id=fd1f4ec347730200ba13a5554ee490c0).

  2. Create a new record under the Dependencies related list.

  3. Within the newly created widget dependency record, create a new record under the JS Includes related list.

  4. Within the new JS include record, click on the magnifying glass button for the UI script field.

  5. In the UI Scripts pop-up window, create a new UI script. Give the UI script a name, then copy and paste the contents of the attached file (workaround2-kp3.js.txt) into the Script field. Save all the changes.

  6. Make a clone of the sp-variable-editor widget (https://<instance-name>.service-now.com/sp_widget.do?sys_id=1ceb35505b3022000d7ec7ad31f91a81).

  7. Under the Dependencies related list, add the widget dependency created previously.

  8. Within the cloned sp-variable-editor widget, scroll down to the Client controller section and add the following code below line 40:

    $rootScope.$emit("sp.form.record.updated");

    This code line will trigger the Catalog UI policies to run again.

 


Related Problem: PRB1269981

Seen In

Kingston Patch 3

Associated Community Threads

There is no data to report.

Article Information

Last Updated:2018-10-02 22:22:23
Published:2018-07-18
workaround2-kp3.js.txt