- Mastering ServiceNow Scripting
- Andrew Kindred
- 226字
- 2021-06-24 19:08:41
onSubmit
The onSubmit client script type runs when a form is saved. This type of script is not that widely used, as we can often use server-side script to perform actions for us once a record is saved, but it can be helpful, as it provides a final chance to execute client-side script before server-side script is run.
The script ServiceNow provides for onSubmit is quite similar to onLoad:
function onSubmit() {
//Type appropriate comment here, and begin script below
}
The onSubmit script type can be used to check field values before a save takes place and abort the save if invalid values exist in fields.
When considering writing an onSubmit script, it is worth thinking about whether that script could run on the server side instead. This is because the client script runs in front of the user, and further processing must wait until the script finishes, whereas on the server side, the code is executed away from the user and can be executed alongside other scripts.
We can see an onSubmit example in Figure 3.3:

For our onSubmit client script example, we can see that this client script is ready for the script to be added for the change table.
- Dreamweaver CS3 Ajax網頁設計入門與實例詳解
- 火格局的時空變異及其在電網防火中的應用
- Ansible Quick Start Guide
- 自動生產線的拆裝與調試
- Visual C++編程全能詞典
- 電腦主板現場維修實錄
- 步步圖解自動化綜合技能
- 愛犯錯的智能體
- 分析力!專業Excel的制作與分析實用法則
- Chef:Powerful Infrastructure Automation
- INSTANT Heat Maps in R:How-to
- 網絡服務搭建、配置與管理大全(Linux版)
- Ansible 2 Cloud Automation Cookbook
- 貫通Hibernate開發
- 案例解說Delphi典型控制應用