- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-04-2022 06:37 AM
Hii All,
In Incident record, there is a related list of Affected CIs. Create a field in Incident form named ‘Affected Cis’ of LIST type which should refer to cmdb_ci table and it should have only those CIs as option to select which are listed in Affected CIs related list.
I have written script include like this
getCIs: function() {
var CIs = '';
var AffectedCIs = current.task_ci;
var getCIs = new GlideRecord('task_ci');
getCIs.addQuery('ci_item', AffectedCIs);
getCIs.query();
while (getCIs.next()) {
CIs += ',' + task.sys_id;
}
return 'sys_idIN' + CIs;
},
And also i used advanced Reference Qualifier as
javascript:new afftectedCIs().getCIs();
but it is not showing records.
Please help me on this requirement.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-07-2022 07:46 AM
Hi
Replace the below code in script include
getCIs: function(current) {
var CIs = [];
var task = current.sys_id;
var getCIs = new GlideRecord('task_ci');
getCIs.addQuery('task', task);
getCIs.query();
while (getCIs.next()) {
CIs.push(getCIs.ci_item.sys_id);
}
return 'sys_idIN' + CIs;
},
Pease mark the response as Helpful/Correct, if applicable. Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-04-2022 07:18 AM
Hi
sorry but this makes no sense. Why do you want to have a field with redundant data? What is the underlying business requirement for that?
And what if the related list changes? How do you want to keep both lists in sync?
Kind regards
Maik
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-07-2022 02:43 AM
Hi
Please include the highlighted text in below code.
javascript:new afftectedCIs().getCIs(current);
Script include
getCIs: function(current) {
var AffectedCIs = current.task_ci;
var getCIs = new GlideRecord('task_ci');
getCIs.addQuery('ci_item', AffectedCIs);
getCIs.query();
while (getCIs.next()) {
CIs += ',' + task.sys_id;
}
return 'sys_idIN' + CIs;
},
Please mark the response as Helpful/Correct, if applicable. Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-07-2022 02:53 AM
Hii Nikita,
as you said I have done.
But still it is not showing Records.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-07-2022 07:46 AM
Hi
Replace the below code in script include
getCIs: function(current) {
var CIs = [];
var task = current.sys_id;
var getCIs = new GlideRecord('task_ci');
getCIs.addQuery('task', task);
getCIs.query();
while (getCIs.next()) {
CIs.push(getCIs.ci_item.sys_id);
}
return 'sys_idIN' + CIs;
},
Pease mark the response as Helpful/Correct, if applicable. Thanks!