How to Hide add me icon in list collector field

VSN
Tera Expert

How to Hide Add me icon for the users belongs to Employe manager group users. can someone help me how to Hide this for group basis..

VSN_0-1744337209455.png

 

3 REPLIES 3

Ankur Bawiskar
Tera Patron
Tera Patron

@VSN 

add this in the dictionary attribute no_add_me=true and it will be gone

 

AnkurBawiskar_0-1744339111819.png

 

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

J Siva
Tera Sage

Hi @VSN 

There's no OOB way to hide the icon on conditional basis. However you can hide that for all the users by using the dictionary attribute called "no_add_me=true".
PFB article which explains more.
https://www.servicenow.com/community/developer-forum/hiding-the-quot-add-me-quot-button-on-list-fiel...

 

Regards,
Siva

Chaitanya ILCR
Kilo Patron

Hi @VSN ,

you can have a onload client script with isolate script as false

here I have taken incident table and watch_list as a reference 

you can change the incident table to your table name and watch_list to you field aneme

function onLoad() {
    //write your logic which checks the user is part of group are not
    var ga = new GlideAjax('checkUserInGroup')
    ga.addParam('sysparm_name', 'checkUserInGroupAjax')
    ga.addParam('spmuserName', g_user.userName)
    ga.addParam('spmgroup', 'addyourGroupnameorsyidHere')
    ga.getXMLAnswer(function(ans) {
        if (ans == 'true')
            hide('add_me_locked.incident.watch_list'); //incident update it with your table name watch_list update it with field name
    });

}

SI

var checkUserInGroup = Class.create();
checkUserInGroup.prototype = Object.extendsObject(AbstractAjaxProcessor, {
    _checkUserInGroup: function(userName, group) {
        return gs.getUser().getUserByID(userName).isMemberOf(group);
    },
    checkUserInGroupAjax: function() {
		return this._checkUserInGroup(this.getParameter('spmuserName'),this.getParameter('spmgroup'));

    },

    type: 'checkUserInGroup'
});

 

 

Please mark my answer as helpful/correct if it resolves your query.

Regards,
Chaitanya