We've updated the ServiceNow Community Code of Conduct, adding guidelines around AI usage, professionalism, and content violations. Read more

Need to hide declarative action assignment button in workspace

Shubham Bongulw
Giga Guru

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- 

ShubhamBongulw_0-1744110506330.png

currently cancel button is visible for all user in action dropdown in workspace. Can someone please help me how to achieve this?

8 REPLIES 8

@Ankur Bawiskar Hey Ankur any help on this?

@Shubham Bongulw 

did you try to debug the condition 1 by 1?

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

yes tried various conditions as well but don't know why it's not working

 

Hello @Shubham Bongulw ,

 

Are you found any solution to isMemberof script condition on declarative action? 

 

I did some tests and gs.getUserID() works perfectly for the assigned_to field, but the gs.getUser().isMemberOf condition does not work and allows anyone to have access to the action.

 

I'm testing in related list action to SOW with this condition: (parent.active == true) && gs.getUser().isMemberOf(parent.assignment_group)