Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
We can use javascript to build a query and inside that script we can call a script include to fetch already associated records which we can utilize in other logic.

<img width="578" height="40" alt="image" src="https://github.com/user-attachments/assets/8360b117-dbce-4bf0-ae32-ac4b618332d7" />
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
//Check if there is already record existing for a particular Issue to Item.

var getAlreadyAssociatedRecords = Class.create();
getAlreadyAssociatedRecords.prototype = Object.extendsObject(global.AbstractAjaxProcessor, {

getSysIdsItem: function(issueId) {

var alreadyAssociatedContent = [];
var gr = new GlideRecord('sn_grc_m2m_issue_item');
gr.addQuery('sn_grc_issue', issueId);
gr.query();

while (gr.next()) {
if (!gr.sn_grc_item.nil())
alreadyAssociatedContent.push(gr.getValue('sn_grc_item').toString());
}
return alreadyAssociatedContent.join(',');

},

type: 'getAlreadyAssociatedRecords'
});
Loading