How to make ui action visible if certain field is not empty?

jenny32
Tera Guru

Hi All,

In incident table I have a field "xyz" which is a reference to "Application" table and in "Application" table I have field "abc" which is of string type.

According to my requirement I have written ui action and now the challenge I'm facing here is I need to hide the button when "abc" field is empty.

I tried putting current.xyz.abc != "" in my ui action condition field. So, for the first time when I open incident form the button is hidden. How can I make it visible when I select "xyz" field.

In ui action "Client callable" is true based on my requirement.

I'm not getting where I'm going wrong. Can anyone suggest me!!!!

Thanks,

Jennifer.

21 REPLIES 21

Hi Jennifer,



From UI action we are calling the script include.


If return statement of script include is true then UI action is visible.


If return statement of script include is false then UI action is not visible.



Thanks,


Mihir


Hi Mihir,



                  How can we check the value returning from script include in ui action?


                  I tried ur code but its not working. Can you tell in more detail how you did it?



Thanks,


Jennifer


Goran WitchDoc
ServiceNow Employee
ServiceNow Employee

As I understand it the Condition on the UI Action is evaluated when the page is loaded. It isn't checked when something changes on the form.



What you can do is a UI policy that hides the button and you set the conditions on when it should be true(visible)



For example. This UI policy hides/shows the button with the action_name "comments_dialog3"



hideshow ui action.PNG



//Göran


Hi Goran,




I tried as per ur code but it's not working.


UI Action


find_real_file.png


UI Policy


find_real_file.png


find_real_file.png



Can you please let me where I'm going wrong?



Thanks,


Jennifer


muettl
Kilo Contributor

hi All


i need help


i have a buttoon problem table "Re-open"


this should only be visible if the state is resolves.


any one can help me?