- 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.
- 大數(shù)據(jù)戰(zhàn)爭(zhēng):人工智能時(shí)代不能不說(shuō)的事
- 電腦上網(wǎng)直通車
- MicroPython Projects
- 空間傳感器網(wǎng)絡(luò)復(fù)雜區(qū)域智能監(jiān)測(cè)技術(shù)
- Docker High Performance(Second Edition)
- Mastering ServiceNow Scripting
- 網(wǎng)中之我:何明升網(wǎng)絡(luò)社會(huì)論稿
- 氣動(dòng)系統(tǒng)裝調(diào)與PLC控制
- C++程序設(shè)計(jì)基礎(chǔ)(上)
- 單片機(jī)技術(shù)項(xiàng)目化原理與實(shí)訓(xùn)
- 新一代人工智能與語(yǔ)音識(shí)別
- Microsoft System Center Data Protection Manager Cookbook
- Hands-On Microservices with C#
- iLike就業(yè)SQL多功能教材
- 中老年人學(xué)數(shù)碼照片后期處理