Change Request UI buttons

anusarma
Kilo Expert

Hi All,

I have a requirement to hide certain OOB UI buttons from the change request form.

As per our design, the change request type is empty (shown as "--None--") when new form is loaded. Based on the details filled in, the type is determined only after it is saved. Based on the type, the workflow proceeds as usual. The issue with UI buttons is that all the active UI buttons are visible on the new form itself (i.e., before type is determined). I need to hide the UI buttons at this stage. Once type is determined, then the buttons are visible as per OOB design itself.

I tried adding conditions based on the type field to the existing UI actions script, however, it is not working. Please provide your inputs to fix this one.

Thanks in advance,

Anu

10 REPLIES 10

anjalichoudhary
Kilo Guru

Hi Anu,



If I am not wrong, I think you need to hide the UI Actions when form is loaded and once it is saved and type is determined then buttons should be visible. If this is the case then you can use OnLoad client script to hide the button on form load. Below link will help:



disabling a ui action while the form is loading




Hope it helps!!



Thanks,


Anjali



Priya Shekar
Giga Guru

Hi Anu,



Please uncheck the "Show insert" field for the UI actions which is not required before creating the change record.


So that the UI Action buttons will be visible only after the insertion.



Thanks,


Priyadarshini



PS: Hit like, Helpful or Correct depending on the impact of the response


sebastian_g_snc
ServiceNow Employee
ServiceNow Employee

Hi,


you could also use the condition of the UI Action: if the type is not determined (or it is a new record) it should equal to false, hence not show the button.


Kind regards


Anurag Tripathi
Mega Patron
Mega Patron

You can just add in the condition f the ui action




current.type!=''



PS: make sure the field name and value is correct as per your instance.


-Anurag