How to add a new variable to a existing catalog item using rest API
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-06-2023 01:33 AM
How to add a new variable to a existing catalog item using rest API

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-06-2023 01:51 AM
Hi @Bobby8,
I wouldn't recommend creating any records through REST, which should be captured in Update Sets.
Your instances will not be in sync anymore, and any manual configuration in dev and transported to other instances, might give issues, or even duplicate records.
Help others to find a correct solution by marking the appropriate response as accepted solution and helpful.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-06-2023 01:54 AM - edited 10-06-2023 01:56 AM
Hello @Bobby8 ,
To add a new variable to an existing catalog item in ServiceNow using the REST API, you'll need to perform the following steps:
Authentication:
Ensure you have the necessary credentials to access the ServiceNow instance via the REST API.
Locate Catalog Item:
Identify the specific catalog item to which you want to add a new variable. Note down its sys_id.
Create Variable:
Use a REST client or a programming language of your choice (e.g., Python with the requests library) to make an HTTP POST request.
Endpoint:
The endpoint to add a variable will look something like this:
POST /api/now/table/sc_cat_item_option
Request Body:
The request body should be a JSON object specifying the details of the new variable. Here's an example of what it might look like:
{
"cat_item": "<sys_id_of_your_catalog_item>",
"order": 100,
"name": "New Variable Name",
"mandatory": "true",
"type": "string",
"active": "true"
}
cat_item: The sys_id of the catalog item to which you want to add the variable.
order: The order in which the variable will appear (adjust as needed).
name: The name of the new variable.
mandatory: Whether the variable is mandatory (true/false).
type: The data type of the variable (e.g., string, integer, etc.).
active: Whether the variable is active (true/false).
Send Request:
Make a POST request to the specified endpoint with the JSON payload in the request body.
Handle Response:
The response will contain information about the newly created variable.
Remember to replace <sys_id_of_catalog_item> with the actual sys_id of the catalog item you're working with.
Please ensure that you have the appropriate permissions and validate your requests against the ServiceNow API documentation, as details might change over time
Thanks & Regards,
Sayali Gurav
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-08-2023 10:06 PM
On looking into the table "sc_cat_item_option" I was able to find the created record but its not included in the catalog item. I need to add a new variable to an existing catalog item
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-08-2023 10:13 PM
To add a new variable to an existing catalog item, you'll likely need to perform an update operation on the database. Here are some general steps you can follow:
1. Identify the catalog item: Make sure you know which catalog item you want to add the variable to.
2. Understand the database structure: Familiarize yourself with the structure of the "sc_cat_item_option" table. Identify the columns that are relevant for adding a new variable.
3. Update the database record: Use SQL queries to add a new record to the "sc_cat_item_option" table with the appropriate values, linking it to the existing catalog item.
4. Verify the changes: Check if the new variable is now included in the catalog item.
Please keep in mind that these are general steps and the specific process might vary depending on the platform or system you're working with. If you're working in a specific software or platform, it might have its own set of tools or methods for making these changes. Always make sure to back up your data before making any database modifications.
Thanks & Regards,
Sayali Gurav