Notifications

292 views

Description

Symptoms

When submitting a catalog item from Service Portal you may notice that some of your Requested Item records have missing variable, Please see the screenshot below

Release

ALL

Cause

When using server.update() in the customized Catalog Item widget.

server.update() re-Initializes the catalog form

Once the variable values are filled for a catalog item in Service Portal, These values are stored in the angular scope. However, When you perform a server.update() after filling in these variables the Server script is rerun and initialize the catalog form. 

Note: After calling server.update() the client script’s data object is automatically overwritten with the server’s data object.

Since these variables values in DOM and $scope are single way bound, The end user will still see the values on Catalog Form UI but when submitting the end user is submitting a new Catalog item form (initialized by server.update()). Thus, fulfillers will see empty RITMs created without any values

Resolution

Switch to OOB SC Catalog Item widget, If you don’t know already follow the steps below,

  1. Navigate to <yourInstance>.service-now.com
  2. Navigate to sp_page_list.do
  3. Filter by Page ID, here it is “sc_cat_item”
  4. Open the widget instance associated to the SC Catalog Item Widget

5. In the widget Instance record,  Change the widget field from Custom SC Catalog Item widget to SC Catalog Item Widget

Workaround

Add a conditional wrapper around the OOB Server Script for SC Catalog item widget

  1. (function () {
  2. // Server Code of the SC Catalog Item widget
  3. if(input.<variable>){ //<variable> place holder for input variable object
  4.   Perform the action initiated from the client
  5.   Custom feature
  6. } else {
  7.   OOB SC Catalog Item code
  8. }
  9. })()

Article Information

Last Updated:2019-08-02 20:45:16
Published:2019-04-25