Business rule to check the updated by is member of assignment group
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-29-2019 02:34 AM
I have a requirement to make a custom field Respond set to true if the updated by is the member of current assignment group.Everything works fine except the if condition, if condition is not fulfilling. Below is the code for After update
(function executeRule(current, previous /*null when async*/) {
var a=current.sys_updated_by;
var b=current.assignment_group;
var c=gs.getUser();
gs.addInfoMessage(b);
gs.addInfoMessage(a);
if(current.sys_updated_by.isMemberOf(current.assignment_group))
{
gs.addInfoMessage('inside if loop');
current.u_responed=true;
}
Regards
Twinkle
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-29-2019 02:59 AM
make it more simple.
try with below sample code.
if(gs.getUser().getUserByID(current.sys_updated_by).isMemberOf(current.assignment_group)){
gs.log('inside if');
current.u_responed=true;
}
else {
gs.log('hey else');
}
Note: Make sure you have written before business rule on UPDATE and you don't need to use current.update().
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-29-2019 03:00 AM
HEllo Twinkle,
sys_updated_by is not reference field. its taking th user_name . so you need to gliderecord the user table and fetch the sysid or you can check it their itself.
Please mark as Correct Answer/Helpful, if applicable.
Thanks!
Abhishek Gardade
Abhishek Gardade