The Now Platform® Washington DC release is live. Watch now!

Help
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

UI action - onLoad issue

mdsannavulla
Kilo Guru

Hi All,

We are making some fields mandatory on click of one UI action button. It is working fine when the form is fully loaded but if we click this button in onLoad it self then it is not asking for fields mandatory its going to next step.

Can we over come the issue in any way?

25 REPLIES 25

chandan_nagbans
Giga Expert

Hello Sannavulla,



I will suggest that you should not allow any mouse clicks while the form is loading. You can show a loading dialog message during the form load. For that you can use javascript "setTimeout()" method. Use the below link as reference.



Sleeps, Delays, or Waits in Client Scripts - ServiceNow Wiki



Hope that helps.


That script is not working for UI action.


You need to put that piece of code in the onload Client Script of the Form you are using. It should be something like below:



=================================


function onLoad()


{


        // Wait for 1 second


        setTimeout(myFunction,1000);  


}


function myFunction()


{


        // do your stuffs here


}


=================================



Let me know if this works.


I tried like above but I am able to click that UI action button and it is not asking for mandatory fields.