ui action overriding submit button

deepanshanand
Kilo Expert

Hi Experts,

i have created a UI Action that is supposed to reset all the fields in the form while creation .

below is the code

if(current.isNewRecord())

{

current.setWorkflow(false);

current.autoSysFields(false);

current.u_phone="";

current.u_type="";

action.setRedirectURL(current);

}

the code above is performing reset functionality but once its pressed Submit button disappears.

please find below screenshot
find_real_file.png  

once i press reset , submit is gone and UPDATE and DELETE comes up

find_real_file.png

Any idea what is the reason of this behaviour

Kind Regards,

Deepansh

1 ACCEPTED SOLUTION

So you need to get it validated at client side. You must use the "client" check box present in the UI Action record. And then call a function from "OnClick" field. And you will be using the client side global variables (g_form,g_user) but not server side global variables (Current,previous).



See the screenshots below, i have created a scenario based on your requirement.



Screen Shot 2017-09-20 at 4.48.39 PM.png



Screen Shot 2017-09-20 at 4.45.01 PM.png


View solution in original post

13 REPLIES 13

path is system properties -> User Interface properties
am i correct?


gtalreja
ServiceNow Employee
ServiceNow Employee

Hello Deepansh,



first of all i think you are also using current.update(); as it will insert the current record.



If you want to make this UI Action visible on the existing record as well, then please remove the code "current.isNewRecord()" from the condition field in UI Action, use it inside the script field only.



Regards,


Gaurav Talreja


Done that
but still same behaviour


gtalreja
ServiceNow Employee
ServiceNow Employee

I created the same scenario in my instance and it worked fine, please do a cache.do, and login again. See screenshots attached.



Screen Shot 2017-09-20 at 11.41.20 AM.png



Screen Shot 2017-09-20 at 11.41.28 AM.png


After you click reset other buttons are still there?
i am unable to see submit button there