REST Access to Multi-Row Variable Sets (MRVS)

Mike McCall
Giga Guru
  • The Internet has a lot of resources around ServiceNow's Service Catalog and Table REST APIs.
  • The Internet also has a growing number of resources around ServiceNow's Multi-Row Variable Sets (MRVSs).

 

What I can't find are mentions of getting or setting values within an MVRS using a REST API. When I try pulling an RITM with "variables.[my MRVS name]," I get back an empty string.

 

Does anyone know if we can or can't access Multi-Row Variable Set values through an out-of-box REST API?

1 ACCEPTED SOLUTION

Mike McCall
Giga Guru

UPDATE: I just successfully put values into the MRVS using the Buy Now API!

Here's the request body I included (using the raw JSON option in Postman):

{
    "sysparm_quantity": 1,
    "variables": {
        "products": "[{\"product_name\":\"test!\"},{\"product_name\":\"test 2!\"}]"
    }
}

In my catalog item, "products" is the MRVS name and "product_name" is the name of a variable in that set.

The syntax around quotations is essential (since the entire value assigned to "products" is a single JSON string).

View solution in original post

5 REPLIES 5

You know, I don't think I actually needed a GET call in the end. 😅 I think I mentioned pulling from existing RITMs because I was looking for general syntax, not because I was pulling from existing tickets.

 

Sorry for that misleading intro! If there's another post that focuses on GET (or an easy explanation for using a different API--maybe the Table API?), someone please share it here. Thanks!