The CreatorCon Call for Content is officially open! Get started here.

How to hide a field with UI action

gunishi
Tera Guru

Hi there, 

 

I have a UI action for a button and upon pressing this button I am going to make a field visible (this will be call Cancel Reason). 

 

How would I make sure field is hidden before this? Would I need to use a separate UI policy/action to hide the field? And how would this work with the button that then reveals it?

 

Many thanks 🙂

G

1 ACCEPTED SOLUTION

Pratiksha2
Mega Sage

Hello @gunishi ,

Establish a UI Policy, set its conditions, and, within the dictionary record, locate the "UI Policy" field. Choose the created UI policy from the dropdown to specify which field you wish to hide.
Include the following script in your UI Action:

 

gsftSubmit(null, g_form.getFormElement(), 'your_policy_name');

 

 

Please Mark Correct if this solves your query and also mark 👍Helpful if you find my response worthy based on the impact.

 

Thanks,

Pratiksha

View solution in original post

8 REPLIES 8

Dr Atul G- LNG
Tera Patron
Tera Patron

Hi @gunishi 

 

UI policy is the good option for this. 

Untick this

LearnNGrowAtul_0-1706610877599.png

 

*************************************************************************************************************
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]

****************************************************************************************************************

Hi @Dr Atul G- LNG 

 

Will this override the UI action to make the button visible though if it is onload? The button makes the field permanently visible (as per requirments) so I need to make sure it is hidden only before this.

Thanks, 

G

Hi @gunishi 

 

Will this override the UI action to make the button visible though if it is onload --> I guess NO. But give a try mate and share feedback

*************************************************************************************************************
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]

****************************************************************************************************************

Vishal Birajdar
Giga Sage

Hi @gunishi 

 

We can do it using UI policy, not good option to use UI action to hide /show the field.

 

 

Vishal Birajdar
ServiceNow Developer

I know one thing, and that is that I know nothing.
- Socrates