ServiceNow Scipt onLoad onChangeのサンプル
onLoad()関数内に書かれたコードはフォームのロード時に実行されます。
function onLoad() {
g_form.setReadOnly('short_description', true);
}
function onLoad() {
g_form.setReadOnly('short_description', true);
}
function onLoad() { g_form.setReadOnly('short_description', true); }
onChange()
フォーム内の値が変更されたときに実行されます。
function onChange(control, oldValue, newValue) {
if (oldValue == newValue)
return;
g_form.setValue('short_description', true);
}
function onChange(control, oldValue, newValue) {
if (oldValue == newValue)
return;
g_form.setValue('short_description', true);
}
function onChange(control, oldValue, newValue) { if (oldValue == newValue) return; g_form.setValue('short_description', true); }
onSubmit()
フォームを保存したときに実行されます。
priorityの値が2のレコードを保存するときにユーザに確認のメッセージを表示する
function onSubmit() {
var priority = g_form.getValue('priority');
if (priority == 2)
return confirm(getMessage('test message'));
function onSubmit() {
var priority = g_form.getValue('priority');
if (priority == 2)
return confirm(getMessage('test message'));
function onSubmit() { var priority = g_form.getValue('priority'); if (priority == 2) return confirm(getMessage('test message'));