Resolved Choice option should visible only for current assignment group users

vasu17
Tera Contributor

HI
Can someone please help on this 
I have requirement is - On the state field , Resolved option needs to be visible only for current assignment group members
If any other user opens the incident form they should able to see only other options (in progress, new, on hold)

but resolved should not be visible 
I have tried below script
Script include 

vasu17_0-1709630591989.png

Onload client script

vasu17_1-1709630664967.png

Thanks 

1 ACCEPTED SOLUTION

Sohithanjan G
Kilo Sage
Kilo Sage

Hi @vasu17 ,

 

Use GlideAjax to call the script include from client side. Make sure script include is client callable. 

function onLoad() {
    var ga = new GlideAjax('getUserDetail');
    ga.addParam('sysparm_name', 'isUserMemberOfGroup');
    ga.addParam('sysparm_group', g_form.getValue('assignment_group'));
    ga.getXML(processResponse);
}

function processResponse(response) {
	var res = response.responseXML.documentElement.getAttribute("answer");
	if (res) {
        g_form.removeOption('state','8'); // use backed name of resolved state
        }

}

 

šŸ™‚

 

Script Include

isUserMemberOfGroup: function() {
        var assignmentGroupId = this.getParameter('sysparm_group');
        var currentUser = gs.getUser();
        return currentUser.isMemberOf(assignmentGroupId);
    },

 

Please mark as Accepted Solution if this solves your query and HIT Helpful if you find my answer helped you. This will help other community mates too..:)

View solution in original post

2 REPLIES 2

Sohithanjan G
Kilo Sage
Kilo Sage

Hi @vasu17 ,

 

Use GlideAjax to call the script include from client side. Make sure script include is client callable. 

function onLoad() {
    var ga = new GlideAjax('getUserDetail');
    ga.addParam('sysparm_name', 'isUserMemberOfGroup');
    ga.addParam('sysparm_group', g_form.getValue('assignment_group'));
    ga.getXML(processResponse);
}

function processResponse(response) {
	var res = response.responseXML.documentElement.getAttribute("answer");
	if (res) {
        g_form.removeOption('state','8'); // use backed name of resolved state
        }

}

 

šŸ™‚

 

Script Include

isUserMemberOfGroup: function() {
        var assignmentGroupId = this.getParameter('sysparm_group');
        var currentUser = gs.getUser();
        return currentUser.isMemberOf(assignmentGroupId);
    },

 

Please mark as Accepted Solution if this solves your query and HIT Helpful if you find my answer helped you. This will help other community mates too..:)

Thanks for the Response