- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-08-2018 03:50 AM
If logged in User is not a member in Assignment group then popup " logged in user not member in that group"
upto this script working fine, at the same time, i would like to popup message" select in Assign to", in case if assign to is not empty then change State=2,
UI Action: chceked:Client, Onclick: onClicking // Script is not working
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');
if(gr.assigned_toISNOTEMPTY)
{
g_form.setValue('state',2);
}
else
{
g_form.addInfoMessage('selct in assign to');
}
}
}
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-08-2018 05:30 AM
Unchecked Client Checkbox and try with below code:
if(gs.getUser().isMemberOf(current.assignment_group))
{
current.assigned_to=gs.getUserID();
current.state=2;
}
else
{
if(current.assigned_to!='')
{
current.state=2;
}
else
{
gs.addInfoMessage('Looged-in user is not a member of the selected Assignment Group');
gs.addInfoMessage('select in assign to');
}
}
action.setRedirectURL(current);
current.update();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-08-2018 05:30 AM
Unchecked Client Checkbox and try with below code:
if(gs.getUser().isMemberOf(current.assignment_group))
{
current.assigned_to=gs.getUserID();
current.state=2;
}
else
{
if(current.assigned_to!='')
{
current.state=2;
}
else
{
gs.addInfoMessage('Looged-in user is not a member of the selected Assignment Group');
gs.addInfoMessage('select in assign to');
}
}
action.setRedirectURL(current);
current.update();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-08-2018 05:47 AM
i have one cocern here please
script is working fine....
incase , Assignment Group : CAB Approval, i am the member in that group,
instead of my name if i selected any other user from my Group then also it should accept his name & save record and change state=2
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-08-2018 06:17 AM
No it will not accept the name, it will assigned to logged in user because he is the group member of assignment group.
In that case select the user of your group member and save the record instead of clicking the UI action button.
Regards,
Tushar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-08-2018 06:31 AM
yes , i request you that , if logged in user changed his Assigned to with other member name from his group..
Ex: i am the Logged in user , and member of CAB Approval group,
CAB Approval users: JOHN, Kelli, Chanikya
if i changed Assigned To Manually to JOHN then also it should accept, because JOHN also my group member......is it possible.??
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-08-2018 06:42 AM
That is not possible because if you already written a code for auto populate the logged-in user it work for populating the same.
I am not getting why you want to change the assigned_to if you need to auto populate the user.
Regards,
Tushar