0% found this document useful (0 votes)
3 views

Client Script

Client scripts enable JavaScript execution in the web browser during specific client events such as form loading, submission, or field changes. They can be used to manipulate form fields, set field values based on user roles, and display messages. There are four types of client scripts: onLoad, onChange, onSubmit, and onCellEdit, each triggered by different user interactions.

Uploaded by

avinash.g7109
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

Client Script

Client scripts enable JavaScript execution in the web browser during specific client events such as form loading, submission, or field changes. They can be used to manipulate form fields, set field values based on user roles, and display messages. There are four types of client scripts: onLoad, onChange, onSubmit, and onCellEdit, each triggered by different user interactions.

Uploaded by

avinash.g7109
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

Client Script

Client scripts allow the system to run JavaScript on the client (web browser)
when client-based events occur, such as when a form loads, after form
submission, or when a field changes value.

Use client scripts to configure forms, form fields, and field values while the user
is using the form. Client scripts can:

> make fields hidden or visible

> make fields read only or writable

> make fields optional or mandatory based on the user's role

> set the value in one field based on the value in other fields

> modify the options in a choice list based on a user's role

> display messages based on a value in a field

Client Script will execute in four ways


On Load: Runs when a form is loaded

On Change: Runs when a particular filed changes value

On Submit: Runs when a form is submitted

On CellEdit: Runs when a cell on a list changes value

Procedure to create client script


1. In the left navigation pane under System Definition we will find the client
script
2.Below is the table where we can find all client scripts.

3.Click on new button to create Client script


4.There are 4 types of client script
onCellEdit
onChange
onLoad
onSubmit
5.Action gets triggerd based on this 4 types of events.
OnLoad
If we select the onLoad then when the page will load, the client script will run.

OnChange
onChange() client script will get executed when user change any value in an
existing form.
OnSubmit
onSubmit() client script will get executed when use submits the form.
onCellEdit
It is used in list view. Cell mean a particular row inside a column. Like a excel
cell.
In list view in service now we will get the value as a tabular form so here one
value is like cell value.So here if we want to modify any value and trigger a
client script then we can use onCellEdit.

You might also like