how to Check user is belong to this group or not
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-03-2017 11:19 PM
When i click on "Assign to me" UI ACTION -button user name is filled in "Assign to" , but user is not belongs to "project Mgnt" group then display message- ''user not in this group''.
var aa=g_user.getUserID();
g_form.setValue('u_assign_to_me',aa);
now i want , 1. if user belong to that group display username in "Assign To" filed
2. if user is not belongs to that assignment group should display message, and assignment group should become blank but display username in "Assign To" filed and based on username ''Assignment Group'' display user related groups in ''Assignment Group'' field.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-03-2017 11:28 PM
Restrict the button to show only when the login person is member of that group.
Place a condition in UI action as --- gs.getUser().isMemberOf(current.assignment_group)
Hope this helps you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-03-2017 11:48 PM
Hi Sneha,
Thanks for your fast replay ,
But here problem is when i select "Project Mngt" group in assignment group then only displaying "UI Action" BUTTON , if i select anther group is goes to hide...
WHAT I AM expecting is when i click on " UI Action " BUTTON user name should display in Assign to field if he belong to that Assignment Group OTHER wise name should display in assign to field but Assignment Group should become blank.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-03-2017 11:55 PM
Place the below code in Server side script of UI Action.
if(gs.getUser().isMemberOf(current.assignment_group)){
current.assigned_to = gs.getUserID();
}
else {
current.assignment_group = "";
current.assigned_to = gs.getUserID();
var gr = new GlideRecord('sys_user_grmember');
gr.addQuery('user', gs.getUserID());
gr.query();
if(gr.next())
{
current.assignment_group = gr.group;
}
}
current.update();
See if this helps you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-04-2017 12:05 AM
RITM form going to submit when i click on UI action button , form should not submit,
and when i click on UIAction assignment group went to bank but user name not displayed in Assign To field.