- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-10-2025 09:14 AM
I need the value in Approval For field because i have to send notification to the assignment group for Vulnerable Item & Remediation Task requested, approved & reject for Exception request.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-10-2025 10:53 PM
you cannot set recipient using email script, only set CC and BCC
Is it the OOTB approval.inserted email which triggers
If yes then there you can add the logic in new notification and trigger it via event Queue on approval table
1) Ensure the OOTB "approval.inserted" notification doesn't trigger for your source table
2) Ensure the new notification triggers only for your source table and then trigger this via your new business rule on sysapproval_approver and specify your new event name
Something like this but please enhance as I am not aware of the table and fields
(function executeRule(current, previous /*null when async*/ ) {
// Add your code here
var appr_Record = current.document_id;
var gr = new GlideRecord("sn_vul_change_approval");
gr.addQuery("sys_id", appr_Record);
gr.query();
if (gr.next()) {
var arr = [];
var vul_record = gr.vul_record.getRefRecord();
var assignmentgroup = vul_record.assignment_group.sys_id;
var groupMembers = new GlideRecord('sys_user_grmember');
groupMembers.addQuery('group', group);
groupMembers.query();
while (groupMembers.next()) {
arr.push(groupMembers.getValue('user'));
}
gs.eventQueue('eventName', current, arr.toString());
}
})(current, previous);
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-10-2025 01:25 PM
Hello @Swati_Jindal
If you want to set "Approval For" field's value as one of the group "Vulnerable Item & Remediation" member, then that can be done via business rule or a flow.
In case where there are multiple group members, then which one do you want to set as approval for (assuming approval for is a reference field to sys_user table) like based upon their skill set, availability, location etc.
Hope that helps!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-10-2025 10:10 PM
I am writing this mail script for sending mail to all member of assignment group but i am not getting mail
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-10-2025 10:53 PM
you cannot set recipient using email script, only set CC and BCC
Is it the OOTB approval.inserted email which triggers
If yes then there you can add the logic in new notification and trigger it via event Queue on approval table
1) Ensure the OOTB "approval.inserted" notification doesn't trigger for your source table
2) Ensure the new notification triggers only for your source table and then trigger this via your new business rule on sysapproval_approver and specify your new event name
Something like this but please enhance as I am not aware of the table and fields
(function executeRule(current, previous /*null when async*/ ) {
// Add your code here
var appr_Record = current.document_id;
var gr = new GlideRecord("sn_vul_change_approval");
gr.addQuery("sys_id", appr_Record);
gr.query();
if (gr.next()) {
var arr = [];
var vul_record = gr.vul_record.getRefRecord();
var assignmentgroup = vul_record.assignment_group.sys_id;
var groupMembers = new GlideRecord('sys_user_grmember');
groupMembers.addQuery('group', group);
groupMembers.query();
while (groupMembers.next()) {
arr.push(groupMembers.getValue('user'));
}
gs.eventQueue('eventName', current, arr.toString());
}
})(current, previous);
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-14-2025 09:34 PM
Hope you are doing good.
Did my reply answer your question?
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader