- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-06-2020 04:31 PM
Hi All,
I am trying to set the assigned to of a HR case after submitting from create new case in HR case management.
below is the business rule created however it is not working in scoped application.
Before Insert
function executeRule(current, previous /*null when async*/ ) {
var Cusr = gs.getUserID();
var Cag = current.assignment_group.getDisplayValue();
if (Cusr.isMemberOf(Cag)){
current.assigned_to = Cusr;
}
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-07-2020 07:08 AM
You can use the script provide in your after-insert BR, and yes it follows best practice to use current.update() in after-insert Business rule.
Use the script below and it will work.
(function executeRule(current, previous /*null when async*/ ) {
var Cusr = gs.getUserID();
//var Cop = current.opened_by;
gs.info('the logged in user is :' +Cusr);
var Cag = current.assignment_group.getDisplayValue();
gs.info('the assignment group is :'+Cag);
if (gs.getUser().isMemberOf(current.assignment_group.getDisplayValue())){
gs.info('into my if loop');
current.assigned_to = Cusr;
current.update();
}
})(current, previous);

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-06-2020 04:49 PM
Hi,
Try with below script.
function executeRule(current, previous /*null when async*/ ) {
if(gs.getUser().isMemberOf(current.assignment_group.name.toString()))
current.assigned_to=gs.getUserID();
}
Kindly mark my answer as Correct and Helpful based on the Impact.
Regards,
Alok
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-06-2020 05:08 PM
Hi
I tried script you provide but assigned is not getting populated.please suggest.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-06-2020 05:23 PM
Could you please share the condition in when to apply section details? I believe the business rule is not getting triggered.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-06-2020 05:25 PM
Also, try checking the update checkbox as true and use the provided script.