- Mark as New
 - Bookmark
 - Subscribe
 - Mute
 - Subscribe to RSS Feed
 - Permalink
 - Report Inappropriate Content
 
11-12-2024 09:15 AM
Solved! Go to Solution.
- Mark as New
 - Bookmark
 - Subscribe
 - Mute
 - Subscribe to RSS Feed
 - Permalink
 - Report Inappropriate Content
 
11-12-2024 09:22 AM - edited 11-12-2024 09:26 AM
If your loop is working, you are overwriting/resetting the task description each time through, so try instead
    task.description += gr.comments + ", ";
A more efficient way to accomplish the same is by only executing the GlideRecord once:
var collector = current.variables.role.toString().split(',');
var gr = new GlideRecord('u_cmdb_ci_role');
gr.addQuery('sys_id', 'IN', current.variables.role);
gr.query();
while (gr.next()) {
    task.description += gr.comments + ", ";
}
- Mark as New
 - Bookmark
 - Subscribe
 - Mute
 - Subscribe to RSS Feed
 - Permalink
 - Report Inappropriate Content
 
11-12-2024 09:22 AM - edited 11-12-2024 09:26 AM
If your loop is working, you are overwriting/resetting the task description each time through, so try instead
    task.description += gr.comments + ", ";
A more efficient way to accomplish the same is by only executing the GlideRecord once:
var collector = current.variables.role.toString().split(',');
var gr = new GlideRecord('u_cmdb_ci_role');
gr.addQuery('sys_id', 'IN', current.variables.role);
gr.query();
while (gr.next()) {
    task.description += gr.comments + ", ";
}
- Mark as New
 - Bookmark
 - Subscribe
 - Mute
 - Subscribe to RSS Feed
 - Permalink
 - Report Inappropriate Content
 
11-12-2024 09:26 AM
@Brad Bowman That is exactly what was happening! 😄 thanks
