Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-22-2024 09:15 PM
Hi,
I want to retrieve incident number using the configuration item sys id. the below query didnt execute. pls let me know the corrrection in the script:
var ciname = "c9db69b797503590ce1536200153afbb";
var inc = new GlideRecord('incident');
inc.addQuery("cmdb_ci.name.sys_id=" + ciname);
inc.addQuery("active=true");
inc.query();
while(inc.next())
{
gs.print(inc.number);
}
Solved! Go to Solution.
1 ACCEPTED SOLUTION
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-22-2024 09:57 PM
2 REPLIES 2
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-22-2024 09:51 PM
Use below snapshot for your reference
var inc = new GlideRecord('incident');
// passing the encoded query here
inc.addEncodedQuery('cmdb_ci.sys_idLIKEb4fd7c8437201000deeabfc8bcbe5dc1');
inc.addQuery("active=true")
inc.query();
while(inc.next())
{
gs.print(inc.number);
}
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-22-2024 09:57 PM