Client Scripts
Client Scripts
Client Scripts are allowing to user to run Java Script on client side (Browser Window) when
client based events are occurred or executed
Such as when a form was, Loads and or submitted form and when a field value is changed and
when you edit cell value from list view
We can be able to use client scripts to configure Forms, Form Fields and Field Values while
user is using any particular form.
onLoad ()
OnLoad client script will runs when the system first loaded on the form and before users can
enter data. Typically, onLoad () client scripts mainly running from client-side of the current form
and t is used to set default record values.
onChange ()
on Change will runs when a particular field value changes on the form. then we can use
onchange client script
onSubmit ()
it will run when a form is submitted. Typically, onSubmit () scripts validate things on the form
and ensure that the submission makes sense. An onSubmit () client script can cancel form
submission by returning a value of false.
OnCellEdit ()
It will run when a user tries to change a cell value from list view then onCellEdit client script will
be execute and provide result
Use of g_scratchpad
The g_scratchpad object will passes the information from the Server to the Client, when we
want to get required information that is not available on the particular form.
1. We can create an access control rules to restrict user who can read and edit field values
on your form. Create a business rules to validate content in form.
2. Create a UI Policy and Data policy to validate content in form.
3. Create an onCellEdit () client script to validate content in list view.
4. Disable list editing for the particular table
GlideList2 : Used to customize (v2) lists, including normal lists and related lists.
GlideUser : This object is used to get session information about the current user and roles.
Procedure
1. Navigate to System DefinitionClient Scripts
2. Open Client Scripts
3. Click on New
Procedure
1. Navigate to System DefinitionClient Scripts
2. Open Client Scripts
3. Click on New
4.Script
Procedure
1. Navigate to System DefinitionClient Scripts
2. Open Client Scripts
3. Click on New
4. Script
Procedure
1. Navigate to System DefinitionClient Scripts
2. Open Client Scripts
3. Click on New
4. Script
Procedure
1. Navigate to System DefinitionClient Scripts
2. Open Client Scripts
3. Click on New
4. Script
5. Open New Incident form check the validation
6. Incident Click on Create New
7. Select any VIP Caller like Fred Luddy
8. Check validation on below screen shot for reference
Exercise: 6 Table Incident
Requirement
1. If customer selected Incident Category is Inquiry/Help, then Subcategory
field should be hide
2. Remove choice 1-High from Impact and Urgency fields
3. Display an Error Message below impact field (Low impact is not prefer high
priority)
Client Script Type
OnChange
Procedure
1. Navigate to System DefinitionClient Scripts
2. Open Client Scripts
3. Click on New
4. Script
Exercise: 7 Table Incident
Requirement
1. When current incident state is New then remove all choices from State field
Choices need to be removed (In-Progress, On-Hold, Resolved, Closed, Cancelled).
2. When current incident State is In-Progress or On-Hold then remove all choices from
State field Choices need to be removed (New, Closed,).
3. When current incident State is Resolved, then remove these all choices
Choices need to be removed (New, In-Progress, On-Hold, Cancelled)
4. When current incident State is Closed, then state field should be Read-only
Procedure
1. Navigate to System DefinitionClient Scripts
2. Open Client Scripts
3. Click on New
4.Script
1. Open New Incident form check the validation
2. Incident Click on Create New
3. If current incident state is New, then rest of states should not be seen
4. If current incident state is In-Progress or On-Hold, then New and Closed States should
not visible
5. In Resolved state display only Closed state value
6. If state is Closed State filed should be Read-only
Procedure
1. Navigate to System DefinitionClient Scripts
2. Open Client Scripts
3. Click on New
4. Script
Procedure
1. Navigate to System DefinitionClient Scripts
2. Open Client Scripts
3. Click on New
4. Script
5. Open New Incident form check the validation
6. Incident Click on Create New Module
7. Change the Priority to 1 then Save it
8. Again change the Priority to 2 then get info message to fill work notes mandatory
Exercise: 10 Table Incident
Requirement: User restriction, not allowing update the cell value from Incident List View
1. Any customer try to change incident state value to 7- Closed action will be cancel and
display alert message to customer
2. Alert Message (System not allow user to update cell value)
Procedure
1. Navigate to System DefinitionClient Scripts
2. Open Client Scripts
3. Click on New
4.Scri
pt
4. Open Incident List View and check the validation
5. Incident Click on All Module
6. Change the state value to 7-Closed
7. Get Error Message (System not allowing user to update cell value)
Procedure
1. Navigate to System DefinitionClient Scripts
2. Open Client Scripts
3. Click on New
4. Script
Procedure
1. Navigate to System DefinitionClient Scripts
2. Open Client Scripts
3. Click on New
4. Script
5. Open New Incident check the validation
6. Select the Category is Software then ticket is auto assign to Software Assignment
Group
7. Select Remaining Category Also Similarly check the validation
Exercise: 13 Table Incident
Requirement: Auto set Caller value into caller field depends on current logged in user
1. Display alert message say Hello message with logged in user full name
Procedure
1. Navigate to System DefinitionClient Scripts
2. Open Client Scripts
3. Click on New
4. Script
Procedure
1. Navigate to System DefinitionClient Scripts
2. Open Client Scripts
3. Click on New
4. Script
Procedure
1. Navigate to System DefinitionClient Scripts
2. Open Client Scripts
3. Click on New
4. Script
5. Open New Incident check the validation
6. Click on Create New module
7. When form is Loaded and state not equal to Resolved hide the Resolution Information
Section