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  ||  10x ServiceNow MVP  ||  ServiceNow Community Leader

View solution in original post

4 REPLIES 4

Ankur Bawiskar
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  ||  10x 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  ||  10x ServiceNow MVP  ||  ServiceNow Community Leader

I have a similar requirement and thank you for the solution you have provided. I tried changing the Context menu -> Export file and an error appears saying - Warning: This is a High Risk file that might get updated again in later releases. Do not alter this file unless necessary.  

Is it still ok to alter this file with the condition? Appreciate your reply. Thank you