How to create system property to restrict users to access context menus?

Ankita Kolhe
Tera Contributor

Hi Community,

 

I have a requirement to restrict users to access 'Export' context menu on list view . I want to only allow access to users who are part of 'Export data' group & has 'export_data' role for the following list:-

incident,request item, sc task & asset.

 

I added myself to 'export Data' group and group has role 'export_data' but not able to see 'Export' context menu for above tables. Below is the screenshot of 'Export' context menu configuration & system property:-

 

AnkitaKolhe_1-1684730536574.png

 

 

AnkitaKolhe_0-1684730394389.png

 

Could anyone please help what's wrong in this?

 

Thanks,

Ankita Kolhe

 

1 ACCEPTED SOLUTION

@Ankita Kolhe 

update as this

!ListProperties.isRelatedList() && !ListProperties.isRefList() && gs.hasRole('export_data') && gs.getUser().isMemberOf('38d8e01bdb7ae910fcf5a51fd39619d2') &&  gs.getProperty('nwd.data.export.tables').indexOf(ListProperties.getTable()) > -1
Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

View solution in original post

3 REPLIES 3

Ankur Bawiskar
Tera Patron
Tera Patron

@Ankita Kolhe 

so it should show only for those tables mentioned in system property?

you can add role check there gs.hasRole('export_data') && gs.getUser().isMemberOf('Export data')

Can you share the condition here?

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

Hi @Ankur Bawiskar ,

 

Yes, it should visible to those tables only(listed on property).

I'm not sure if the property configured is in right way & also how to check for the current table in context menu condition.

 

condition:- !ListProperties.isRelatedList() && !ListProperties.isRefList() && gs.hasRole('export_data') && gs.getUser().isMemberOf('38d8e01bdb7ae910fcf5a51fd39619d2')

@Ankita Kolhe 

update as this

!ListProperties.isRelatedList() && !ListProperties.isRefList() && gs.hasRole('export_data') && gs.getUser().isMemberOf('38d8e01bdb7ae910fcf5a51fd39619d2') &&  gs.getProperty('nwd.data.export.tables').indexOf(ListProperties.getTable()) > -1
Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader