Notifications

127 views

Description

Unable to submit the REST API's if the set value is not a string.

Steps to Reproduce

  • 1st set of - Steps to reproduce

 

  1. Create a catalog item with one checkbox variable
    2. Try to use buyItem, addToCart or checkout REST API's by passing the checkbox variable as boolean value[true/false]

    Expected : The REST API should succeed without any issues
    Actual : It is throwing an error

    Note: Try the following checkout REST API for reference
    {
    "sysparm_quantity": "1",
    "variables": {
    "checkbox": true,
    "IO:dc538d1a53331300a708ddeeff7b1290": "true"
    },
    "sysparm_item_guid": "1c538d1a53331300a708ddeeff7b1290",
    "get_portal_messages": "true",
    "sysparm_no_validation": "true",
    "sysparm_requested_for": "6816f79cc0a8016401c5a33be04be441",
    "delivery_address": ""
    }

 

  • 2nd set of - Steps to reproduce

1. Navigate to any OOB Kingston or London Instance.
2. Go to Catalog item - Sales Laptop.
3. Create 2 Variables - var1, var2
4. Create new onChange Client Script for var1
where write simple function
g_form.setValue('os2',12);
5. Navigate to /sp and search for Sales Laptop.
6. Change var1 value to anything.
7. Make sure var2 is automatically change to 12.
8. Click order now

Expected - Order should be placed and request should get generated.
Actual - Order is not placed. It says "Submitting" and page is freeze.

Console Errors
POST https://empaking.service-now.com/api/sn_sc/v1/servicecatalog/items/e212a942c0a80165008313c59764eea1/order_now 404 (Not Found)

 

  • 3rd set of - Steps to reproduce 
  1. Navigate to any OOB Kingston or London Instance.
    2. Go to Catalog item - Sales Laptop.
    3. Create new multi-row variable - Fixed Asset with 2 Variables - Cost & Qty
    4. Create new onChange Client Script for Qty
    where write simple function
    g_form.setValue('cost',12);
    5. Navigate to /sp and submit catalog item.

Expected - RITM record should all variables with correct values in Variable set. 

Actual - RITM record shows blank in variables inside multi row variable set 

Workaround

When trying to set the value using a client script. It is advisable to pass the value as a string instead of a boolean value or a numerical value. setValue API expects a String as a parameter.

Using g_form.setValue('cost', '12') instead of g_form.setValue('cost', 12) can be used as a workaround.

 


Related Problem: PRB1298035

Seen In

There is no data to report.

Fixed In

Madrid

Associated Community Threads

There is no data to report.

Article Information

Last Updated:2019-06-03 08:41:19
Published:2019-03-07