Skip to content

Commit 3af3fbe

Browse files
authored
Check already associated records and use them in filter query
1 parent 124fef6 commit 3af3fbe

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
//Check if there is already record existing for a particular Issue to Item.
2+
3+
var getAlreadyAssociatedRecords = Class.create();
4+
getAlreadyAssociatedRecords.prototype = Object.extendsObject(global.AbstractAjaxProcessor, {
5+
6+
getSysIdsItem: function(issueId) {
7+
8+
var alreadyAssociatedContent = [];
9+
var gr = new GlideRecord('sn_grc_m2m_issue_item');
10+
gr.addQuery('sn_grc_issue', issueId);
11+
gr.query();
12+
13+
while (gr.next()) {
14+
if (!gr.sn_grc_item.nil())
15+
alreadyAssociatedContent.push(gr.getValue('sn_grc_item').toString());
16+
}
17+
return alreadyAssociatedContent.join(',');
18+
19+
},
20+
21+
type: 'getAlreadyAssociatedRecords'
22+
});

0 commit comments

Comments
 (0)