- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-04-2018 01:56 PM
Ui Action: Assign me
if(gs.getUser().isMemberOf(current.assignment_group));
{
current.assigned_to = gs.getUserID();
}
if he is not a member in that group then popup message
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-05-2018 12:29 AM
Hi,
Try using the below script in UI Action with Client field checked.
Onclick: onClicking()
function onClicking()
{
var gr = new GlideRecord('sys_user_grmember');
gr.addQuery('user',g_user.userID);
gr.addQuery('group',g_form.getValue('assignment_group'));
gr.query();
if(gr.next())
{
g_form.setValue('assigned_to',g_user.userID);
}
else
{
g_form.addInfoMessage('Looged-in user is not a member of the selected Assignment Group');
}
}
Hope this helps.
Thanks,
Archana

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-04-2018 02:35 PM
Ahh ok. If this is in a business rule you need the stub code from the business rule as well, but your code needs to be formatted like this without the semicolon at the end of the if statement.
(function executeRule(current, previous /*null when async*/) {
if(gs.getUser().isMemberOf(current.assignment_group)) {
current.assigned_to = gs.getUserID();
}
else {
gs.addInfoMessage("not mamber");
}
})(current, previous);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-04-2018 03:21 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-04-2018 03:35 PM
If this is a ui action, try just doing this:
if(gs.getUser().isMemberOf(current.assignment_group)) {
current.assigned_to = gs.getUserID();
}
else {
gs.addInfoMessage("not mamber");
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-05-2018 12:29 AM
Hi,
Try using the below script in UI Action with Client field checked.
Onclick: onClicking()
function onClicking()
{
var gr = new GlideRecord('sys_user_grmember');
gr.addQuery('user',g_user.userID);
gr.addQuery('group',g_form.getValue('assignment_group'));
gr.query();
if(gr.next())
{
g_form.setValue('assigned_to',g_user.userID);
}
else
{
g_form.addInfoMessage('Looged-in user is not a member of the selected Assignment Group');
}
}
Hope this helps.
Thanks,
Archana
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-05-2018 06:43 AM
Thanks Archana!
it is working fine....great