Hide widget for a group

Poorva Bhawsar
Mega Sage

Hi Community,

 

How to hide a service portal widget for a group.

 

I need help in the logic.

 

Thanks,

Poorva Bhawsar

9 REPLIES 9

pra16
Tera Contributor

Hi Poorva,

 

In the server script you can hide the reopen button by a flag for that particulate user group.  For example:

 

 HTML:

<button type="button"
class="btn btn-default"
ng-if="c.data.visibility.showReopen">
${Reopen}
</button>

 

Server script:

data.visibility.showReopen = true;

var xyz = utils.userIsMember(curUser, 'XYZ'); //use sys_id of the group
if(xyz){
data.visibility.showReopen = false;
}
 
If my response proves useful, please mark it as helpful.
 

Getting these many errors after adding this code.

 

PoorvaBhawsar_0-1708925877140.png

 

Poorva Bhawsar
Mega Sage

Here is the logic i have added in server script. So, whenever user clicks on this action and if its assigned to xyz group then need to restrict that action and throw and error msg accordingly.

 

if (input && input.action == 'reopenIncident' && incidentGr.get(incidentSysId)){
        if(incidentGr.assignment_group == '4a88d493db8ee3407316e3334a961923')
        current.setAbortAction(true);
        gs.addErrorMessage('Incident cannot be reopened as its assigned to command centre');
    }
 
But i am getting javascript error for this.

Hi @Poorva Bhawsar ,

 

Cany you please share the code for setting the property of "showReopen" to true.

 

Thanks,

Allu Gopal.

I dont have any property like that.