Need to hide declarative action assignment button in workspace

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-08-2025 04:09 AM
Hi Community,
I have requirement in which I want to make buttons visible in change request form in workspace only when user logged belong to assignment group or he has change manager role.
I can manage the code if it was UI action but not sure how Declarative action code works or how can I add condition to hide it. I have configured it as below-
currently cancel button is visible for all user in action dropdown in workspace. Can someone please help me how to achieve this?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-08-2025 04:13 AM
Sightly helpful :
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.
Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]
****************************************************************************************************************

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-08-2025 05:14 AM
Hi,
I already have gone through this documentation but it didn't helped at all.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-08-2025 05:44 AM
the OOTB "Cancel change request" form declarative action has condition in "Script condition" field
Simply add this to your existing Script Condition field
Existing Condition && gs.hasRole('change_manager') && gs.getUser().isMemberOf(current.assignment_group)
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-08-2025 05:57 AM
Hey Ankur,
tried this as well but it's getting hidden from current assignment group user
. Here is the complete code- gs.hasRole('itil,sn_change_write') && new global.ChangeFormUI(current).isCancelAvailable() && gs.hasRole('change_manager') && gs.getUser().isMemberOf(current.assignment_group)