How to hide button button on state change

ritaaudi
Tera Contributor

Hi: I want to be able to hide the Close Complete button on the RITM form when the state changes to Closed incomplete. I tried this but it didn't work:

ritaaudi_0-1712088041723.png

I don't get the alert 2 popup. Any idea? Thank you!

1 ACCEPTED SOLUTION

@ritaaudi If you dont mind, can you mark my response as correct where I suggested to create the UI action.


Please mark this response as correct or helpful if it assisted you with your question.

View solution in original post

21 REPLIES 21

ritaaudi
Tera Contributor

ritaaudi_0-1712090832432.png

 

g k1
Tera Guru

try using ui policy on task table

gk1_0-1712091033017.png

gk1_1-1712091087556.png

 

ritaaudi
Tera Contributor

I got the same $$ error...

-O-
Kilo Patron
Kilo Patron

You can run

 

self.jQuery('[id="<action_name>"]')
    .add('[id="<action_name>_bottom"]')
    .show();

 

to show buttons on forms and

 

self.jQuery('[id="<action_name>"]')
    .add('[id="<action_name>_bottom"]')
    .hide();

 

to hide buttons on forms, in Client Scripts or UI Policy scripts, but it will only work in Core UI, which is kinda' phased out.

 

Therefore I suggest NOT going down this road and implementing a solution that better fits the paradigm; e.g. make the UI Action a client one and have it 1st change the state according to what is right for that button (even if the user previously selected some other state) and only after that submit the form.

So even if a user 1st selects (say) On Hold as state, but presses the Close button, the UI Action would 1st switch state to Closed Completed and submit the form afterwards.

 

You could add in a check whether the state has been changed from the one (with which the form has been) loaded and warn the user that the previous state selection will be discarded - to make it more fool proof.

Utilizing a display business rule that stores the original state value on the scratchpad and regular UI Action client scripting you can come up to a solution that will also work in Next Exp.

ritaaudi
Tera Contributor

I decided to create a new UI Action for Closed Incomplete instead. Thank you all!