Hide/Show UI Action in Client Script

ican
Tera Contributor

Use Case:
I have a UI Action and I want to hide/show it based on a field form value.

OR

How to rename UI Action in client script?

 

How to do this?

 

Thanks.

1 ACCEPTED SOLUTION

Robbie
Kilo Patron
Kilo Patron

Hi @ican,

 

Best practice and the easiest way would be to leverage the UI Action 'Condition' field.

A simple example and syntax would be as follows:

 

current.state == 3 // where the state field value is equal to 3. You can add additional conditions by simply using ''&&' current.fieldname etc 

 

To help others (or for me to help you more directly), please mark this response correct by clicking on Accept as Solution and/or Kudos.

 

Thanks, Robbie

View solution in original post

9 REPLIES 9

I tried this one, in the condition i set g_form.getValue(<fieldName>) == 'true' but both UI Action is displaying.

Hi @ican 

 

As per my response (Robbie), the syntax you require is:

current.fieldname == true;

 

To help others (or for me to help you more directly), please mark this response correct by clicking on Accept as Solution and/or Kudos.

 

Thanks, Robbie

 

PS - @Anurag Tripathi - I hope you don't mind me replying here, it popped up on my 'activities'

 

No Worries mate. @Robbie 

@ican  Just to add. UI Action conditions are always evaluated on the server side. So regardless of whether your ui action is servers side or client side you read the field values using Current.

-Anurag

Robbie
Kilo Patron
Kilo Patron

Hi @ican,

 

Best practice and the easiest way would be to leverage the UI Action 'Condition' field.

A simple example and syntax would be as follows:

 

current.state == 3 // where the state field value is equal to 3. You can add additional conditions by simply using ''&&' current.fieldname etc 

 

To help others (or for me to help you more directly), please mark this response correct by clicking on Accept as Solution and/or Kudos.

 

Thanks, Robbie

Maddysunil
Kilo Sage

@ican 

To show/hide UI action you can use your logic in UI action condition ..

You can't rename a UI action in client side, May be you want to rename a field label something like below

g_form.setLabelOf('comments', 'Who is the requested for\'s AVP or VP?');

 

  

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

 

Thanks