- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-04-2024 09:09 PM
Hi All,
I'm new to ServiceNow. I have a requirement creating new user onboarding via catalog item. I achieved that through workflow.
Now I need to fetch all the ticket created for this catalog item by fetching all its variables and its values. Can anyone help me with the code to fetch all the ticket details of a particular catalog item variable and its values present in it.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-06-2024 01:35 AM
Hi,
Please try to use below
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-04-2024 10:16 PM
Hi @Ramya SL ,
You can access the varaibles used in your catalog item from table below :
Request Item to Variable: sc_item_option_mtom
Variable: sc_item_option
You can do a gliderecord on this table with appropriate query conditons to get all the varaibles of your catalog. We are unware of your catalog and its variables hence script cant be provided. I hope this helps...
☑️ Please mark responses as HELPFUL or ACCEPT SOLUTION to assist future users in finding the right solution....
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-04-2024 11:09 PM
My Catalog item name "New User Onboarding" and its variables
first_name,
last_name,
user_id
department
start_date
ticket_status
description
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-05-2024 01:34 AM
Is the below code is correct for fetching the variable names and its values of a catalog item. Please help
var now_GR = new GlideRecord('sc_req_item');
if (now_GR.get('sc_item_option')) {
var variables = now_GR.variables.getElements();
for (var i=0;i<variables.length;i++) {
var question = variables[i].getQuestion(); //getQuestion() is to fetch the variable names in ci
gs.log(question.getLabel() + ":" + question.getValue())// getLable() is variable names and getValue() is variable values
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-05-2024 01:35 AM
Is the below code is correct for fetching the variable names and its values of a catalog item. Please help
var now_GR = new GlideRecord('sc_req_item');
if (now_GR.get('sc_item_option')) {
var variables = now_GR.variables.getElements();
for (var i=0;i<variables.length;i++) {
var question = variables[i].getQuestion(); //getQuestion() is to fetch the variable names in ci
gs.log(question.getLabel() + ":" + question.getValue())// getLable() is variable names and getValue() is variable values
}
}