Service Catalog REST API issue with Multi row Variable set in Quebec
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-24-2022 05:52 AM
I have a Record Producer with a Multi Row Variable Set. The Record Producer can be submitted using Service Portal Catalog or it can be called through a Widget using a REST API. Submission through Catalog works well but when I submit using a REST API, i get an error:
{"error":{"message":"Unexpected token: o","detail":"SyntaxError: Unexpected token: o (sys_script_include.0ae1e780c3001200d68d3b0ac3d3ae4e.script; line 196)"},"status":"failure"}
There is a difference in the payload when i submit using the catalog and REST API. The Cataog submission has multi row variable set values which nested a "". On Rome, both options seem to work fine. But on Quebec, only the first option 1 seems to work. Is this a known Servicenow bug ?
Thank you !
Option 1: Catalog Submission Payload:
{
"var1": "value0",
"mrvs": "[{\"mrv_var1\": \"value1\"},{\"mrv_var2\": \"value2\"}]"
}
Option 2: REST API payload:
{
"var1": "value0",
"mrvs": [
{"mrv_var1": "value1"},
{"mrv_var2": "value2"}
]
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-24-2022 08:16 AM
Hi Priyanka,
May be you can try JSON.stringify for the MRVS value while creating the payload for REST API and check if it works.
Thanks,
Mitesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-12-2022 07:20 AM
I was able to confirm that the issue is fixed in Rome. But on Quebec, we must follow Option #1 which is a encoded JSON string.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-18-2024 03:03 AM
If it's about the use case like Submit Record Producer (POST), where there are mvrs, I've checked and the format with "flat" variables is working:
{
'sysparm_quantity': 1,
'variables': {
"issue": "report_of_user_access",
"bank_account": "Piotr B. Bank Account",
"country":"9138b7111b1234823412384213",
"describe_your_issue_in_detail_and_include_attachments_if_relevant": "TEST",
"internal_contact": "5857123423412341234123421341",
"platform": "ServiceNow",
"company_code_variable": "05091234123421341234212"
}
}
It means that variables that are in mvrs don't need to be embedded in further arrays. In the below example, variables like "internal contact", "company_code_variable" come from mvrs, but are used in the flat manner.