- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-12-2021 08:39 PM
HI All,
I need to create a Business rule that would check if opened by is member of Service Desk then set field values of assigned to, to the user who opened the ticket and assignment group to Service Desk.
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-13-2021 03:17 AM
Write a Display BR to check if the the logged in User is member of group or not.
g_scratchpad.membership = gs.getUser().isMemberOf('Service Desk');
Then you can create an onLoad client script and Use the following code:
function onLoad() {
if (g_form.isNewRecord()) {
if (g_scratchpad.membership) {
g_form.setValue('assignment_group', 'sys id of ServiceDesk group');
g_form.setValue('assigned_to', g_user.userID);
}
}
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-13-2021 02:39 AM
Hi,
Create a after BR which run on Insert and use the code
(function executeRule(current, previous /*null when async*/) {
// Add your code here
var open=current.opened_by;
var gr2 = new GlideRecord('sys_user_group');
gr2.addQuery('name', 'Service Desk'); //check your group name
gr2.query();
while (gr2.next()){
var groupsys = gr2.sys_id;
}
var gr = new GlideRecord('sys_user_grmember');
gr.addQuery('group', groupsys);
gr.addQuery('user',current.opened_by);
gr.query();
if (gr.next()) {
current.assignment_group='d625dccec0a8016700a222a0f7900d06';//sys_id of service desk group
current.assigned_to=open;
current.update();
}
})(current, previous);
Please mark reply as Helpful/Correct, if applicable. Thanks!
Aman