- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-04-2020 07:59 AM
Hi All,
I have a requirement, If Opened by user is part of an Assignment Group then a responded checkbox should be default checked. I thought to using OnChange() client script using GlideAjax . Can anyone help me how to do it?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-06-2020 09:01 PM
As some have suggested, a Business Rule would be the best way to go, and because you're looking at the Opened by user, which is set on insert, an Advanced Before Insert Business Rule will do the trick. No need for it to run on update:
Here's the "Condition" field contents:
gs.getUser().isMemberOf("MediaFirst SRO Team")
And the "Script" field contents (you may have to change the field name):
(function executeRule(current, previous /*null when async*/) {
//set the Responded field to "true"
current.u_responded = true;
})(current, previous);
The reason your After Business Rule was not working is because you did not actually update the record. You do not need to, nor should you, include the update() function when using a Before Business Rule. And because you want to trigger an SLA or not based on the Responded field value, you are better off setting it before the insert of the record.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-06-2020 04:33 PM
Hi,
Create a Before-Insert/Update business rule and use the below script.
(function executeRule(current, previous /*null when async*/) {
if(current.opened_by.isMemberOf(current.assignment_group)){
current.setValue('u_responded', 'true');
}
})(current, previous);
Also, make sure that the start condition of the SLA contains u_responded is true.
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 09:01 PM
As some have suggested, a Business Rule would be the best way to go, and because you're looking at the Opened by user, which is set on insert, an Advanced Before Insert Business Rule will do the trick. No need for it to run on update:
Here's the "Condition" field contents:
gs.getUser().isMemberOf("MediaFirst SRO Team")
And the "Script" field contents (you may have to change the field name):
(function executeRule(current, previous /*null when async*/) {
//set the Responded field to "true"
current.u_responded = true;
})(current, previous);
The reason your After Business Rule was not working is because you did not actually update the record. You do not need to, nor should you, include the update() function when using a Before Business Rule. And because you want to trigger an SLA or not based on the Responded field value, you are better off setting it before the insert of the record.