Case view - Button visible/not visible

CV1
Tera Contributor

Hi All ,

Have a requirement where on case form view, a button "Manager Approval" need to be hidden when location is empty.

For this I created a UI action on Case table where I am checking for location if nil() in condition. This works as expected where if location is blank on case, the button "Manager Approval" is not visible and when a case contains location "Manager Approval" button is shown.

The requirement is when the user selects location on the blank location field, the button "Manager Approval" should re-appear. Please guide on how to achieve this.

TIA

1 REPLY 1

Brad Bowman
Kilo Patron
Kilo Patron

You can do this with the controversial (not supported, but often used) DOM manipulation.  First you would remove the condition from the UI Action.  Next, create a UI Policy on the case table with the Condition Location is empty.  Add the Isolate script field to the UI Policy form if it's not already shown.  On the Script tab click Run Scripts then put something like this in the Execute if true script

function onCondition() {
	$$('#manager_approval')[0].hide();
}

where manager_approval is the value in the Action field on the UI Action.  A similar script to show the button will be in the Execute if false script

function onCondition() {
	$$('#manager_approval')[0].show();
}

Save the UI Policy, then uncheck the Isolate script box and save it again, ensuring this box remains unchecked

BradBowman_0-1726017034853.png

BradBowman_1-1726017086891.png

BradBowman_2-1726017136411.png