【ServiceNow】client-scriptの起動タイミング

Client Script Types

クライアントスクリプトの起動タイミングは3つ

  1. onLoad
  2. onChange
  3. onSubmit

解説

onLoad

画面の初期読み込み時の画面表示でフォームとかに値を入れる時。

onChange


フィールドの値が変わった時

onSubmit

create,updateとかのクライアントサイドバリデーション

原文

Client Script Types

A Client Script executes client-side script logic when forms are:
  • Loaded
  • Changed
  • Submitted

onLoad

onLoad Client Scripts execute script logic when forms are loaded. Use onLoad Client Scripts to manipulate a form's appearance or content. For example, setting field or form-level messages based on the presence of a value. Use onLoad Client Scripts sparingly as they impact form load times.
onLoad Client Scripts execute client-side Javascript before the user can interact with a form.

onChange

onChange Client Scripts execute script logic when a particular field's value changes. Use onChange Client Scripts to respond to field values of interest and to modify another field's value or attributes. For example, if the State field's value changes to Closed Complete, generate an alert and make the Description field mandatory.
onChange Client Scripts execute client-side script logic when a user changes a field's value.

onSubmit

onSubmit Client Scripts execute script logic when a form is submitted. Use onSubmit Client Scripts to validate field values. For example, if a user submits a Priority 1 record, the script can generate a confirmation dialog notifying the user that the executive staff are copied on all Priority 1 requests.
onSubmit Client Scripts execute their script logic when users submit forms.  The script can prevent writing to the database if the form is incomplete or invalid or out of range values are detected.
NOTE: There is an onCellEdit Client Script type, which is for lists rather than forms. onCellEdit Client Scripts are not addressed in this module.
Next Post Previous Post
No Comment
Add Comment
comment url