- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-06-2018 12:13 AM
hi everyone,
i have a doubt. how to get all related incidents which are attached to a problem record . for example if 3 incidents are attached to a problem i want to display those incident number in a field ( let us say for ex: description field).
i written the code using business rules:
var string=[];
var obj={};
var gr=new GlideRecord("incident");
gr.addQuery("problem_id","=",current.sys_id);
gr.query();
while(gr.next())
{
//current.work_notes=gr.getDisplayValue('number');
string.push(gr.getDisplayValue('number'));
}
for (var i=0;i<string.length;i++)
{
current.description=string[i].number;
}
any help is appreciated.. thank you
Solved! Go to Solution.
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-06-2018 02:28 AM
Can you try below :
var string=[];
var gr=new GlideRecord("incident");
gr.addQuery("problem_id",current.sys_id);
gr.query();
while(gr.next())
{
string.push(gr.number.toString());
for (var i=0;i<string.length;i++)
}
current.description=string.join(',');
current.update();

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-06-2018 12:44 AM
Hi,
Try Below Code :
var string=[];
var gr=new GlideRecord("incident");
gr.addQuery("problem_id",current.sys_id);
gr.query();
while(gr.next())
{
string.push(gr.number);
}
for (var i=0;i<string.length;i++)
{
current.description=string[i];
current.update();
}
Thanks,
Ravi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-06-2018 01:34 AM
thank you for your reply. i tried the code which you have posted , its not working

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-06-2018 02:28 AM
Can you try below :
var string=[];
var gr=new GlideRecord("incident");
gr.addQuery("problem_id",current.sys_id);
gr.query();
while(gr.next())
{
string.push(gr.number.toString());
for (var i=0;i<string.length;i++)
}
current.description=string.join(',');
current.update();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-06-2018 02:38 AM
thank you for reply