how to Check user is belong to this group or not

Kishore8
Kilo Guru

find_real_file.png

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.

18 REPLIES 18

Hi Prasdeep ,




Thanks for your fast replay ,



here code is not working , it is submitting form and not taking any user name into Assign To field .



could you plse ...


Can you please share screenshot of UI action here.


find_real_file.png




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, based on Assign To user name Groups should populate in Assignment Group,   in which groups he is being as a member


Here is the updated code.



current.u_assign_to_me = gs.getUserID();


if(gs.getUser().isMemberOf('current.assignment_group'))


{


//do nothing


}


else


{


var gr = new GlideRecord('sys_user_grmember');


gr.addQuery('user', gs.getUserID());


gr.query();


if(gr.next())


{


current.assignment_group = gr.group; //One of the random group will be set here. I'm not clear with your req if this is expected?


}


current.update();


Hi Pradeep ,



It's working...



but problem is i am being as a member in around 5 groups but here it takes group name automatically first one from list of my member ship groups.



i am expecting manually i want to select my group, so i want to display my member ship groups only on Assignment Group.



find_real_file.png



Form should not submit automatically. when i click on submit button then only should submit form.