- Mastering ServiceNow Scripting
- Andrew Kindred
- 273字
- 2021-06-24 19:08:41
onLoad
The onLoad client script type runs script when a form is loaded. This can be helpful to manipulate data on a form before a user starts using it. Sometimes, when a form loads slowly, it is possible to see onLoad client scripts doing their job.
When selecting the onLoad type, the script field will be populated with the onLoad function ServiceNow provides for you, as long as the script field hasn't already been edited. The script looks as follows:
function onLoad() {
//Type appropriate comment here, and begin script below
}
This is the onLoad function to put your script into. Any script running onLoad will take time to run and slow down loading time, so it is always worth trying to keep onLoad client scripts to a minimum, and short, if necessary. I have been involved in projects simply to reduce the amount of onLoad client scripts on forms to reduce load times.
In the following figure, Figure 3.1, we can see what this type of client script will look like:

In the preceding figure, we can see an onLoad client script ready to be written for the incident table. As the comment states in the code, replace the comment in the code with the functionality of your script, and then begin writing underneath the comment inside the onLoad function.
- 課課通計算機原理
- 輕松學C語言
- Python Artificial Intelligence Projects for Beginners
- Verilog HDL數字系統設計入門與應用實例
- 反饋系統:多學科視角(原書第2版)
- 大數據挑戰與NoSQL數據庫技術
- PLC與變頻技術應用
- 電氣控制及Micro800 PLC程序設計
- 網站規劃與網頁設計
- 分布式Java應用
- 開放自動化系統應用與實戰:基于標準建模語言IEC 61499
- Raspberry Pi 3 Projects for Java Programmers
- 巧學活用Photoshop
- SolarWinds Server & Application Monitor:Deployment and Administration
- Containerization with Ansible 2