- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-06-2020 02:12 AM
i want to fetch few groups in an array,
after that if the change request is having approval for this groups the Approval automatically has to set No longer Required.
so here how can i write an business rule, which will check the approval group, if the approval group is one of these fetched ones, then the approval has to set "No longer Required"
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-08-2020 01:48 AM
Hi,
so can you add a log above if and print current.assignment_group and groups array and check what the value it contains.
Technically,both should be group sys_ids and if you think the assignment group present in your list of groups, then manually verify the sys_id of assignment group in the groups array or in your table.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-09-2020 02:44 AM
HI Asif, we have small addon on this.
this scenario has to work only when the change request RISK is Low.
i have added few more lines (highlighted) but it did not worked and even logs are not coming.
var groups = [];
var gr_groups = new GlideRecord("u_epic_group_approvals");
gr_groups.query();
while(gr_groups.next()) {
groups.push(gr_groups.getValue("u_epic_group_approvals"));
}
var changeRec=current.parent.getRefRecord();
if(changeRec.getValue('risk' == 4)){
var arrayUtil = new ArrayUtil();
//check if the assignment group falls in our groups.
gs.log("Entered into the BR " +current.assignment_group.getDisplayValue());
if(arrayUtil.contains(groups, current.assignment_group)) {
//If yes, then update approval to no longer required.
gs.log("Entered into the If condtion"+current.approval+"-------"+current.sys_id);
gs.eventQueue("TEstBR",current,current.sys_id,current.approval);
}
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-09-2020 02:46 AM
try now
var groups = [];
var gr_groups = new GlideRecord("u_epic_group_approvals");
gr_groups.query();
while(gr_groups.next()) {
groups.push(gr_groups.getValue("u_epic_group_approvals"));
}
var changeRec=current.parent.getRefRecord();
if(changeRec.getValue('risk') == 4){
var arrayUtil = new ArrayUtil();
//check if the assignment group falls in our groups.
gs.log("Entered into the BR " +current.assignment_group.getDisplayValue());
if(arrayUtil.contains(groups, current.assignment_group)) {
//If yes, then update approval to no longer required.
gs.log("Entered into the If condtion"+current.approval+"-------"+current.sys_id);
gs.eventQueue("TEstBR",current,current.sys_id,current.approval);
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-09-2020 02:59 AM
no its not working, this is in after insert BR which is created on sysapproval_group table
parent is change request record, have written BR to update the approvals.
in the change request, we have RISK field, this approval has to run when the rick is low (4)

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-09-2020 03:07 AM
are you able to get the risk value in business rule ?
best way to check add logs .
var groups = [];
var gr_groups = new GlideRecord("u_epic_group_approvals");
gr_groups.query();
while(gr_groups.next()) {
groups.push(gr_groups.getValue("u_epic_group_approvals"));
}
var changeRec=current.parent.getRefRecord();
gs.log('Risk Value '+ changeRec.getValue('risk') );
//if(changeRec.getValue('risk') == 4){
var arrayUtil = new ArrayUtil();
//check if the assignment group falls in our groups.
gs.log("Entered into the BR " +current.assignment_group.getDisplayValue());
if(arrayUtil.contains(groups, current.assignment_group)) {
//If yes, then update approval to no longer required.
gs.log("Entered into the If condtion"+current.approval+"-------"+current.sys_id);
gs.eventQueue("TEstBR",current,current.sys_id,current.approval);
//}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-09-2020 03:35 AM
no risk value as null
Mark the comment as a correct answer and helpful if it helps.