Client script realtime Scenarios

Madhulatha
Tera Contributor

 

Hello Everyone,

I am looking to switch my current domain to ServiceNow. Could anyone please share some real-time client script scenarios so that I can practice and validate my knowledge?
1 ACCEPTED SOLUTION

Aditya_hublikar
Mega Sage

Hello @Madhulatha ,

 

 

  1. Compare two date fields and show a message or populate a field if they are not equal(onChange)

  2. Populate caller email automatically when caller is selected (onChange)

  3. Populate manager field when caller is selected  (onChange)

  4. Auto populate logged-in user in “Requested For” variable in catalog item (Catalog Client Script (onLoad)

  5. Populate multiple catalog variables based on one variable selection (Catalog Client Script (onChange)

  6. Show or hide fields based on another field value (onChange)

  7. Make a field mandatory when a specific condition is met (onChange)

  8. Remove mandatory condition if value changes  (onChange)

  9. Validate start date and end date before submitting form  (onSubmit)

  10. Prevent form submission if validation fails  (onSubmit)

  11. Auto populate user details (phone, email, department) when user is selected  (onChange)

  12. Populate building name when location is selected  (onChange)

  13. Populate users based on assignment group (onChange)

  14. Clear dependent fields when parent field changes  (onChange)

  15. Show error message when invalid data is entered (onChange)

  16. Restrict form submission if user is not part of a specific group (onSubmit)

  17. Show specific fields when a new form loads  (onLoad)

  18. Set default values when form opens (onLoad)

  19. Display warning message when priority is high (onChange)

  20. Auto populate short description based on category  (onChange)

  21. Disable or make field read-only based on conditions  (onChange)

  22. Clear field values if condition not satisfied (onChange)

  23. Validate numeric values before saving record (onSubmit)

  24. Display informational message when form loads (onLoad)

 

you can refer this threads :

https://www.servicenow.com/community/itsm-forum/scenarios-of-client-script-server-script/td-p/341225...

 

https://www.servicenow.com/community/developer-articles/client-script-in-servicenow-with-some-use-ca...

 

https://www.servicenow.com/community/developer-forum/want-some-use-cases-for-client-script-business-...

 

 

https://www.servicenow.com/community/developer-blog/mastering-client-scripts-in-servicenow-a-practic...

 

 

If this helps you then mark it as helpful and accept as solution.

Regards,

Aditya

 

View solution in original post

6 REPLIES 6

Tanushree Maiti
Kilo Patron

Hi @Madhulatha 

 

What domain are you working currently. Do you want to move ServiceNow or you have basic experience in ServiceNow already.

 

Because if you are new to ServiceNow , Client script is not the first topic you should starts with. 

Please mark this response as Helpful & Accept it as solution if it assisted you with your question.
Regards
Tanushree Maiti
ServiceNow Technical Architect
Linkedin:

Hello @Tanushree Maiti ,

 

Yes i have knowledge on serviceNow, but i need more real time scenarios to practice.

 

 

Hi @Madhulatha 

 

You can check these questions as well.

 

1.Syntax for call back function,how will pass parameters?
2. Create an alert message using client script
3.What parameters are required for onChange() client scripts?
4.Implication of Glide Aggregate API.
5.Can we execute an OnChange Client Script during form load? If so, how?
6.Explain the OnCellEdit Client Script with a real-time use case
7.If we create a on load client script and before Business rule on load,which one will run first,and why?
8.What is strict mode in new client scripts, and how is it implemented?
9.What is a global UI script, and how can it be used?
10.Explain scripting layers in servicenow?
11.What are the different ways to access server-side data in a Client Script?
12.What is the order of execution between UI Policies and Client Scripts?
13.Can we write Global client script?
14.What is global client script,uses and drawbacks of global client script.
15.How can a catalog client script update a list collector variable?
16.What are the key considerations when using GlideAjax in client scripts?
17.Difference between client script and catalog client script?
18.How do you receive as response in client script?
19.What are the different ways to make field mandatory?
20.Difference between global vs scoped client script.which one is suggested approach?
21.How to access dot walked field value in Client Script?
22.10.Difference between glide record vs getReference or getReference vs getValue?
23.How can we prevent form submission using client script?
24.Limitations of oncelledit type?
25.Why g_form object will not work in onCellEdit Client Script?

Please mark this response as Helpful & Accept it as solution if it assisted you with your question.
Regards
Tanushree Maiti
ServiceNow Technical Architect
Linkedin:

Aditya_hublikar
Mega Sage

Hello @Madhulatha ,

 

 

  1. Compare two date fields and show a message or populate a field if they are not equal(onChange)

  2. Populate caller email automatically when caller is selected (onChange)

  3. Populate manager field when caller is selected  (onChange)

  4. Auto populate logged-in user in “Requested For” variable in catalog item (Catalog Client Script (onLoad)

  5. Populate multiple catalog variables based on one variable selection (Catalog Client Script (onChange)

  6. Show or hide fields based on another field value (onChange)

  7. Make a field mandatory when a specific condition is met (onChange)

  8. Remove mandatory condition if value changes  (onChange)

  9. Validate start date and end date before submitting form  (onSubmit)

  10. Prevent form submission if validation fails  (onSubmit)

  11. Auto populate user details (phone, email, department) when user is selected  (onChange)

  12. Populate building name when location is selected  (onChange)

  13. Populate users based on assignment group (onChange)

  14. Clear dependent fields when parent field changes  (onChange)

  15. Show error message when invalid data is entered (onChange)

  16. Restrict form submission if user is not part of a specific group (onSubmit)

  17. Show specific fields when a new form loads  (onLoad)

  18. Set default values when form opens (onLoad)

  19. Display warning message when priority is high (onChange)

  20. Auto populate short description based on category  (onChange)

  21. Disable or make field read-only based on conditions  (onChange)

  22. Clear field values if condition not satisfied (onChange)

  23. Validate numeric values before saving record (onSubmit)

  24. Display informational message when form loads (onLoad)

 

you can refer this threads :

https://www.servicenow.com/community/itsm-forum/scenarios-of-client-script-server-script/td-p/341225...

 

https://www.servicenow.com/community/developer-articles/client-script-in-servicenow-with-some-use-ca...

 

https://www.servicenow.com/community/developer-forum/want-some-use-cases-for-client-script-business-...

 

 

https://www.servicenow.com/community/developer-blog/mastering-client-scripts-in-servicenow-a-practic...

 

 

If this helps you then mark it as helpful and accept as solution.

Regards,

Aditya