Skip to content

Commit 2ab192b

Browse files
authored
Script Include that takes parameters and creates M2M records
1 parent 22c23b2 commit 2ab192b

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
var issueAssociationinRL = Class.create();
2+
issueAssociationinRL.prototype = Object.extendsObject(global.AbstractAjaxProcessor, {
3+
4+
createRisk: function(){
5+
var itemIds = this.getParameter('sysparm_item_ids');
6+
var issueId = this.getParameter('sysparm_issue_id');
7+
var result={};
8+
9+
itemIds = itemIds.split(',');
10+
if (itemIds.length == 1 && itemIds[0] == ''){
11+
result.error = gs.getMessage('Missing Risk');
12+
}
13+
14+
for(i=0; i<itemIds.length; i++){
15+
var mapping = new GlideRecord('sn_grc_m2m_issue_item');
16+
mapping.initialize();
17+
mapping.sn_grc_issue = issueId;
18+
mapping.sn_grc_item = itemIds[i];
19+
mapping.insert();
20+
}
21+
result.count = itemIds.length;
22+
return JSON.stringify(result);
23+
24+
},
25+
26+
type: 'issueAssociationinRL'
27+
});

0 commit comments

Comments
 (0)