- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-22-2019 04:08 AM
Hello Guys,
What i want is ::> Need entire details about a ticket in "Script-background", All details like [ Child ticket, assigned to, Assigned group, summary, create on, and so on...... ]
Below code is not even showing me "Script-background", but its not giving me any output
var dts = new GlideRecord('incident');
dts.addQuery('number','INC0010120');
dts.query();
if(dts.next()){ dts.info(' exists'); } else { dts.info('does not exists'); }
Can some one please show me how to get all the details about a ticket in code [ Child ticket, assigned to, Assigned group, summary, create on, and so on...... ]
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-22-2019 07:26 AM
it would be parent_incident ,
rl.addQuery('parent_incident', dts.sys_id);

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-22-2019 04:16 AM
Your script should be like below:
var dts = new GlideRecord('incident');
dts.addQuery('number','INC0010120');
dts.query();
if(dts.next()){ gs.info(' exists'); } else { gs.info('does not exists'); }
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-22-2019 04:20 AM
Hello SaiRaviKiran Akella,
Thank you for replying me
How to get other values like [ Child ticket, assigned to, Assigned group, summary, create on] for incident : INCXXXXXXX

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-22-2019 05:49 AM
var dts = new GlideRecord('incident');
dts.addQuery('number','INC0010120');
dts.query();
if(dts.next()){
gs.info(' exists');
gs.info(dts.assigned_to); //add back end value of assigned to field
gs.info(dts.assignment_group); //add back end value of assignment group field
gs.info(sys_created_on);
}
else { gs.info('does not exists'); }
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-22-2019 05:49 AM
I'm not sure that I correctly understand your requirements. Try the following code in Background Script
var dts = new GlideRecord('incident');
if (!dts.get('number','INC0009009')) {
gs.print('does not exists');
} else {
var keys = Object.keys(dts);
keys.forEach(function (field) {
if (field !== "sys_meta" && dts[field] != null && typeof dts[field].nil === "function" && !dts[field].nil()) {
gs.print(field + "=" + dts[field].getDisplayValue());
}
});
}
It will display results like
made_sla=true
upon_reject=Cancel all future Tasks
sys_updated_on=2018-12-12 23:30:24
child_incidents=0
number=INC0009009
sys_updated_by=admin
opened_by=System Administrator
sys_created_on=2018-08-30 01:06:52
sys_domain=global
state=New
sys_created_by=admin
knowledge=false
impact=3 - Low
active=true
priority=4 - Low
sys_domain_path=/
opened_at=2018-08-30 01:06:16
caller_id=David Miller
short_description=Unable to access the shared folder.
description=Unable to access the shared folder. Please provide access.
notify=Do Not Notify
sys_class_name=Incident
sys_id=57af7aec73d423002728660c4cf6a71c
incident_state=New
urgency=2 - Medium
reassignment_count=0
severity=3 - Low
hierarchical_variables=variable_pool
approval=Not Yet Requested
sys_mod_count=4
reopen_count=0
escalation=Normal
upon_approval=Proceed to Next Task
category=Inquiry / Help
To see child incidents you can see the following code:
var inc = new GlideRecord("incident");
var parentNumber = "INC0007001";
inc.addQuery("parent_incident.number", parentNumber);
inc.query()
while (inc.next()) {
gs.print(inc.number + " is child incident of " + parentNumber);
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-22-2019 06:14 AM
Hello Oleg,
thank you for helping me,
My Requirement: only to display the child ticket id for a incident ticket. can you please suggest here