- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-16-2018 08:24 AM
plz tell where the problem is in this code. this is not assigning the task to found group
var groupSysID ;
var groupName = current.variables.group_name;
var gr = new GlideRecord("sys_user_group");
gr.addQuery("name", "groupName");
gr.query();
if (gr.next()) {
groupSysID = gr.sys_id;
gs.addInfoMessage("found group" + gr.sys_id);
task.assignment_group = groupSysID;
}
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-16-2018 09:58 AM
var groupName = current.variables.group_name;
var gr = new GlideRecord("sys_user_group");
gr.addQuery("name", groupName);
gr.query();
if (gr.next()) {
var groupSysID = gr.sys_id;
gs.addInfoMessage("found group" + gr.sys_id);
task.assignment_group = groupSysID;
}
** i used groupName in double quotes ("") which was creating problems

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-16-2018 08:40 AM
Hi,
You'd need to assign the groupsysID variable down after the gr.next with the gr.sys_id;
Currently, it's listed at the top with nothing...?
Also I think there's some other issues going on.
So try:
var groupName = g_form.getValue('group_name');
var gr = new GlideRecord("sys_user_group");
gr.addQuery('name', groupName);
gr.query();
if (gr.next()) {
var groupSysID = gr.sys_id;
gs.addInfoMessage("found group" + gr.sys_id);
task.assignment_group = groupSysID;
task.update();
}
Only part I'm unsure about is if your current.variables.group_name is correct? Double check that it's not u_group_name or whatever.
Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-16-2018 09:57 AM
thanks but i was wrong i used groupName in "" and that was creating issue.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-16-2018 10:02 AM
Hi,
Glad it all worked out.
Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-10-2018 10:31 AM
Hmm...I'm glad you figured out the answer and marked your own response as correct, but I suggested this 3 months ago, which somehow turned out to be the correct answer. Anyways, glad you got it.
Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!