Resolve all button Issue
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-31-2023 02:49 AM
Hi Experts,
I have written the below code for resolving the records based on the Vulnerability. when ever I click on the resolve all button only that record is getting closed but not the other records. Can anyone help with this.
Thanks in advance
function onClickResolveall() {
sn_vul.Modal.popupResolveAppItemModal();
var relatedItems = new GlideRecord('sn_vul_app_vulnerable_item');
relatedItems.addQuery('vulnerability', current.vulnerability);
relatedItems.addEncodedQuery('active=true^stateIN1,2');
relatedItems.query();
while (relatedItems.next()) {
relatedItems.state = 101; // Resolved state
relatedItems.resolution_reason = current.resolution_reason;
relatedItems.active = false;
relatedItems.update();
}
action.setRedirectURL(current);
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-31-2023 06:48 PM
Hi @priya pretty ,
Can you try moving the encoded query above the addquery ?
If my answer solves your question please mark it as Helpful 👍🏻 and Accepted ✅
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-01-2023 07:56 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-01-2023 09:11 AM
Hi @priya pretty ,
Try chagning your code 1 line, since you are dot walking the while loop is ending up iterating the same object hence closing closing only current record, also try to add some logs in your query to erify if your query is returing multiple records.
relatedItems.resolution_reason = current.getValue("resolution_reason");
Aman Kumar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-05-2023 05:18 AM