if logged in user is not a member in that group

chanikya
Tera Guru

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 

1 ACCEPTED SOLUTION

Archana Reddy2
Tera Guru

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

View solution in original post

11 REPLIES 11

Glad to hear that 🙂

Can you help me in this Thread please

How to Stop Duplicate Record creation: https://community.servicenow.com/community?id=community_question&sys_id=8b17ce76db7597007b337a9e0f9619e5,