Drop-down values from the field should populate the UI action.

Eswari K
Tera Contributor

Hi all, There is a field which contains five dropdown values. When i select the first value in the dropdown it should pop-up the UI action. In this scenario, I've created a client script but its reflecting error.

EswariK_0-1714039823209.png

EswariK_1-1714040126309.png

UI action

EswariK_2-1714040163731.png

 

 

1 ACCEPTED SOLUTION

ok , this is intresting for this you need to create a UI POLICY (ADVANCE SCRIPT)... See the below example.

create an UI Policy and change to the advanced view. {example logic given below}

 

Set the conditions that you normally would have on the UI Action. Make sure the "On load" & "Reverse if false" is checked like this:

 

SohailKhilji_0-1714043354820.png

 

 

And now for the magic to happen. Go into the Script section and check the Run scripts.

Put in the following code and as you can see we are using the action name as an identifier to find the UI Action and then simply using show() & hide() to make the button visible or not depending if the condition is true or not.

 

EDIT: This picture has been updated:

SohailKhilji_1-1714043354629.png

 

 

If you have been doing this in your dev you will now see that your button will hide and show depending if you change the priority to 1 or not.

 


☑️ Please mark responses as HELPFUL or ACCEPT SOLUTION to assist future users in finding the right solution....

LinkedIn - Lets Connect

View solution in original post

8 REPLIES 8

ok , this is intresting for this you need to create a UI POLICY (ADVANCE SCRIPT)... See the below example.

create an UI Policy and change to the advanced view. {example logic given below}

 

Set the conditions that you normally would have on the UI Action. Make sure the "On load" & "Reverse if false" is checked like this:

 

SohailKhilji_0-1714043354820.png

 

 

And now for the magic to happen. Go into the Script section and check the Run scripts.

Put in the following code and as you can see we are using the action name as an identifier to find the UI Action and then simply using show() & hide() to make the button visible or not depending if the condition is true or not.

 

EDIT: This picture has been updated:

SohailKhilji_1-1714043354629.png

 

 

If you have been doing this in your dev you will now see that your button will hide and show depending if you change the priority to 1 or not.

 


☑️ Please mark responses as HELPFUL or ACCEPT SOLUTION to assist future users in finding the right solution....

LinkedIn - Lets Connect

Thank you so much @Sohail Khilji ! its working fine now.

Its working fine in table side. How to proceed this same functionality in workspace.

Hi @Eswari K ,

 

Happy to help, lets close this convo for this issue here and request you to create a new thread for the same tagging me.

 


☑️ Please mark responses as HELPFUL or ACCEPT SOLUTION to assist future users in finding the right solution....

LinkedIn - Lets Connect

Sid_Takali
Kilo Patron
Kilo Patron

Hi @Eswari K Go through this blog. The exact user story explained/Resolved here 

https://www.servicenow.com/community/in-other-news/how-to-hide-show-an-ui-action-on-field-changes/ba...

 

Regards,

Siddharam