Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Seeking Guidance on Advanced Scripting in ServiceNow

Abhinav_Ranjan
Tera Contributor

I'm interested in learning more about advanced scripting in ServiceNow. Can anyone recommend resources or provide examples of complex scripting scenarios?

1 ACCEPTED SOLUTION

Sid_Takali
Kilo Patron

Hi @Abhinav_Ranjan 

Introduction to ServiceNow Scripting and 

Learn JavaScript on the Now Platform and 

There's a course called Scripting in ServiceNow Fundamentals On Demand available on Now learning. You can access this for free with a partner portal account, or for some $ without one.

 

Regards,

Sid

View solution in original post

2 REPLIES 2

Sid_Takali
Kilo Patron

Hi @Abhinav_Ranjan 

Introduction to ServiceNow Scripting and 

Learn JavaScript on the Now Platform and 

There's a course called Scripting in ServiceNow Fundamentals On Demand available on Now learning. You can access this for free with a partner portal account, or for some $ without one.

 

Regards,

Sid

Community Alums
Not applicable

Hi @Abhinav_Ranjan ,

 

There are many sources to learn. Few are below:

- Servicenow Course

- Youtube

- Youtube

 

Books:

  • "Mastering ServiceNow Scripting" by Andrew Kindred.
  • "Learning ServiceNow" by Tim Woodruff.

Scenario 1: Set a Field Value Based on Another Field

Objective: When a new incident is created, automatically set the priority field to '2 - High' if the category is 'Network'.

Scenario 2: Display an Alert on Form Load

Objective: Display a message to the user using an alert when a change request form is loaded, if the state is 'New'.

Scenario 3: Calculate and Display Age of Incident

Objective: Add a field to the incident form that calculates and displays the age of the incident in days from the opened_at date.

Scenario 4: Default Values in a New Record

Objective: When a new task record is created, automatically set the due_date to one week from the current date.

Scenario 5: Validate Email Format

Objective: Before a user record is saved, ensure that the email field contains a properly formatted email address.

Scenario 6: Prevent Deletion Based on Condition

Objective: Prevent the deletion of an incident if its state is 'Resolved' or 'Closed'.

Scenario 7: Send Notification on Record Update

Objective: Send an email notification to the assigned user whenever the priority of an incident is changed.

Scenario 8: Make Field Mandatory Based on Another Field

Objective: Make the sub_category field mandatory when the category field is set to 'Hardware'.

Scenario 9: Populate Caller Information

Objective: Automatically populate the caller_id field in an incident form based on the currently logged-in user.

Scenario 10: Auto-Close Incidents

Objective: Automatically close incidents that are in the 'Resolved' state for more than 7 days.

 

I started answering community questions recently. If my answer helped you in any way, please mark it as helpful or correct. It would be a great boost.