<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>question Looking for more use cases of servicenow Scripting in Community Central forum</title>
    <link>https://www.servicenow.com/community/community-central-forum/looking-for-more-use-cases-of-servicenow-scripting/m-p/3543383#M6893</link>
    <description />
    <pubDate>Fri, 15 May 2026 01:47:27 GMT</pubDate>
    <dc:creator>sanjay8613</dc:creator>
    <dc:date>2026-05-15T01:47:27Z</dc:date>
    <item>
      <title>Looking for more use cases of servicenow Scripting</title>
      <link>https://www.servicenow.com/community/community-central-forum/looking-for-more-use-cases-of-servicenow-scripting/m-p/3543383#M6893</link>
      <description />
      <pubDate>Fri, 15 May 2026 01:47:27 GMT</pubDate>
      <guid>https://www.servicenow.com/community/community-central-forum/looking-for-more-use-cases-of-servicenow-scripting/m-p/3543383#M6893</guid>
      <dc:creator>sanjay8613</dc:creator>
      <dc:date>2026-05-15T01:47:27Z</dc:date>
    </item>
    <item>
      <title>Re: Looking for more use cases of servicenow Scripting</title>
      <link>https://www.servicenow.com/community/community-central-forum/looking-for-more-use-cases-of-servicenow-scripting/m-p/3543397#M6894</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://www.servicenow.com/community/user/viewprofilepage/user-id/514926"&gt;@sanjay8613&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Go through these course and other resources. from script itself, you will find the usecases.&lt;/P&gt;&lt;P&gt;1.&amp;nbsp;&lt;A href="https://learning.servicenow.com/lxp/en/now-platform/introduction-to-scripting-in-servicenow?id=learning_course_prev&amp;amp;course_id=4e2bcc3a93ebb9105402393d6cba102c" target="_blank" rel="noopener noreferrer"&gt;Introduction to Scripting in ServiceNow&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;2.&amp;nbsp;&lt;A href="https://learning.servicenow.com/lxp/en/now-platform/scripting-in-servicenow-fundamentals-on-demand-washington?id=learning_course_prev&amp;amp;course_id=be18563893873a98f2d9bc686cba106e&amp;amp;s=1&amp;amp;ssa=3" target="_blank" rel="noopener noreferrer"&gt;Scripting in ServiceNow Fundamentals&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;3. Refer syllabus for scripting :&amp;nbsp;&lt;A href="https://learning.servicenow.com/lxp/en/instructor-led-training/scripting-in-servicenow-fundamentals-ssnf-syllabus?id=kb_article_view&amp;amp;sysparm_article=KB0012764" target="_blank" rel="noopener noreferrer"&gt;KB0012764 Scripting in ServiceNow Fundamentals (SSNF) Syllabus&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;4. Go through once related youtube videos&lt;/P&gt;&lt;P&gt;&lt;A href="https://www.youtube.com/watch?v=Ccxb4UJKF9c" target="_blank" rel="nofollow noopener noreferrer"&gt;https://www.youtube.com/watch?v=Ccxb4UJKF9c&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://www.youtube.com/watch?v=WLNQinTkLfQ" target="_blank" rel="nofollow noopener noreferrer"&gt;https://www.youtube.com/watch?v=WLNQinTkLfQ&lt;/A&gt;&lt;/P&gt;&lt;P&gt;5. Practice in&amp;nbsp; your&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;&lt;A href="https://developer.servicenow.com/dev.do" target="_blank" rel="noopener noreferrer"&gt;Personal Developer Instance (PDI)&lt;/A&gt;&lt;/STRONG&gt;.&lt;/P&gt;&lt;P&gt;6.&lt;A class="" href="https://www.servicenow.com/community/developer-articles/client-script-in-servicenow-with-some-use-case/ta-p/2330011" target="_blank" rel="noopener"&gt;Client Script in ServiceNow With some use case.&lt;/A&gt;&lt;/P&gt;&lt;P&gt;7.&lt;A href="https://www.learnnowlab.com/Business-Rules/" target="_blank" rel="noopener"&gt;https://www.learnnowlab.com/Business-Rules/&lt;/A&gt;&lt;/P&gt;&lt;P&gt;8.&lt;A href="https://www.servicenow.com/community/developer-forum/want-some-use-cases-for-client-script-business-rule-script/m-p/3009082" target="_self"&gt;want some use cases for Client Script, Business rule , Script Include , and Glide Ajax &lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;9.&lt;A class="" href="https://www.servicenow.com/community/developer-blog/mastering-client-scripts-in-servicenow-a-practical-youtube/ba-p/3450461" target="_blank" rel="noopener"&gt;Mastering Client Scripts in ServiceNow – A Practical YouTube Playlist for Real-World Scenarios&lt;/A&gt;&lt;/P&gt;&lt;P&gt;10.&lt;A class="" href="https://www.servicenow.com/community/developer-articles/script-action-a-practical-example/ta-p/3136671" target="_blank" rel="noopener"&gt;Script Action: A Practical Example!&lt;/A&gt;&lt;/P&gt;&lt;P&gt;etc.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 15 May 2026 02:33:22 GMT</pubDate>
      <guid>https://www.servicenow.com/community/community-central-forum/looking-for-more-use-cases-of-servicenow-scripting/m-p/3543397#M6894</guid>
      <dc:creator>Tanushree Maiti</dc:creator>
      <dc:date>2026-05-15T02:33:22Z</dc:date>
    </item>
    <item>
      <title>Re: Looking for more use cases of servicenow Scripting</title>
      <link>https://www.servicenow.com/community/community-central-forum/looking-for-more-use-cases-of-servicenow-scripting/m-p/3543415#M6895</link>
      <description>&lt;P&gt;hi&amp;nbsp;&lt;a href="https://www.servicenow.com/community/user/viewprofilepage/user-id/514926"&gt;@sanjay8613&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;Hi&amp;nbsp;&amp;nbsp; ,&lt;/P&gt;
&lt;P&gt;Here are some real-time ServiceNow scripting use cases&lt;/P&gt;
&lt;P&gt;&lt;A href="https://servicenowspectaculars.com/servicenow-scripting-use-cases-2025/" target="_blank"&gt;https://servicenowspectaculars.com/servicenow-scripting-use-cases-2025/&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://notes.collegehive.in/books/subject/page/servicenow-scripting-scenarios" target="_blank"&gt;https://notes.collegehive.in/books/subject/page/servicenow-scripting-scenarios&lt;/A&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;DIV class="qMYqUG_convSearchResultHighlightRoot"&gt;
&lt;DIV class="" data-turn-id-container="request-6a0596d9-9af0-8323-ac3f-c1d21f3a45ac-9" data-is-intersecting="true"&gt;
&lt;DIV class="relative w-full overflow-visible"&gt;
&lt;SECTION class="text-token-text-primary w-full focus:outline-none has-data-writing-block:pointer-events-none [&amp;amp;:has([data-writing-block])&amp;gt;*]:pointer-events-auto R6Vx5W_threadScrollVars scroll-mb-[calc(var(--scroll-root-safe-area-inset-bottom,0px)+var(--thread-response-height))] scroll-mt-[calc(var(--header-height)+min(200px,max(70px,20svh)))]" dir="auto" data-turn-id="request-6a0596d9-9af0-8323-ac3f-c1d21f3a45ac-9" data-turn-id-container="request-6a0596d9-9af0-8323-ac3f-c1d21f3a45ac-9" data-testid="conversation-turn-10" data-scroll-anchor="false" data-turn="assistant"&gt;
&lt;DIV class="text-base my-auto mx-auto pb-10 [--thread-content-margin:var(--thread-content-margin-xs,calc(var(--spacing)*4))] @w-sm/main:[--thread-content-margin:var(--thread-content-margin-sm,calc(var(--spacing)*6))] @w-lg/main:[--thread-content-margin:var(--thread-content-margin-lg,calc(var(--spacing)*16))] px-(--thread-content-margin)"&gt;
&lt;DIV class="[--thread-content-max-width:40rem] @w-lg/main:[--thread-content-max-width:48rem] mx-auto max-w-(--thread-content-max-width) flex-1 group/turn-messages focus-visible:outline-hidden relative flex w-full min-w-0 flex-col agent-turn"&gt;
&lt;DIV class="flex max-w-full flex-col gap-4 grow"&gt;
&lt;DIV class="min-h-8 text-message relative flex w-full flex-col items-end gap-2 text-start break-words whitespace-normal outline-none keyboard-focused:focus-ring [.text-message+&amp;amp;]:mt-1" dir="auto" tabindex="0" data-message-author-role="assistant" data-message-id="8ed8e547-72a6-42be-95f0-282ca661ae2f" data-message-model-slug="gpt-5-5" data-turn-start-message="true"&gt;
&lt;DIV class="flex w-full flex-col gap-1 empty:hidden"&gt;
&lt;DIV class="markdown prose dark:prose-invert wrap-break-word w-full light markdown-new-styling"&gt;
&lt;P data-start="0" data-end="64" data-is-last-node="" data-is-only-node=""&gt;&lt;STRONG&gt;This helps you get hands-on experience with real-time scenarios.&lt;/STRONG&gt;&lt;/P&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;DIV class="z-0 flex min-h-[46px] justify-start"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV class="mt-3 w-full empty:hidden"&gt;
&lt;DIV class="text-center"&gt;&lt;I&gt;If this response was helpful, please consider marking it as&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;Correct&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;and&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;Helpful&lt;/STRONG&gt;. You may mark more than one reply as an accepted solution.&lt;/I&gt;&lt;/DIV&gt;
&lt;DIV class="text-center"&gt;&lt;I&gt;thanks ,&lt;/I&gt;&lt;/DIV&gt;
&lt;DIV class="text-center"&gt;&lt;I&gt;tejas&lt;/I&gt;&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/SECTION&gt;
&lt;DIV class="contents"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;DIV class="pointer-events-none -mt-px h-px translate-y-[calc(var(--scroll-root-safe-area-inset-bottom)-14*var(--spacing))]" aria-hidden="true"&gt;&amp;nbsp;&lt;/DIV&gt;</description>
      <pubDate>Fri, 15 May 2026 03:50:49 GMT</pubDate>
      <guid>https://www.servicenow.com/community/community-central-forum/looking-for-more-use-cases-of-servicenow-scripting/m-p/3543415#M6895</guid>
      <dc:creator>Tejas Adhalrao</dc:creator>
      <dc:date>2026-05-15T03:50:49Z</dc:date>
    </item>
    <item>
      <title>Re: Looking for more use cases of servicenow Scripting</title>
      <link>https://www.servicenow.com/community/community-central-forum/looking-for-more-use-cases-of-servicenow-scripting/m-p/3543433#M6897</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://www.servicenow.com/community/user/viewprofilepage/user-id/514926"&gt;@sanjay8613&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;These Client scripts use cases will help you to gain hands on practice..&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Example 1: OnChange Script with Value Set :&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;For this example, we have five fields, Good, Fast, Cheap, and Result. &amp;nbsp;&lt;/P&gt;&lt;P&gt;You know the saying, good, fast, cheap, pick 2?&lt;/P&gt;&lt;P&gt;Here is an example of a client script for this scenario. &amp;nbsp;Note that I use comments '//' to explain the client script.&lt;/P&gt;&lt;P&gt;I wrote this just for the change of the Good field. &amp;nbsp;However you probably would also want this for the fast and cheap fields. &amp;nbsp;That means you would need to also add scripts for those scenarios. &amp;nbsp;This is one of the drawbacks of client scripts.&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Client Script: Good onChange&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;When: onChange&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;onChange of field: u_good&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Script:&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE&gt;function onChange(control, oldValue, newValue, isLoading, isTemplate) {
   //If the form is loading or the new value of the changing field is empty exit the script
   if (isLoading || newValue == '') {
      return;
   }
   //If Good is true, cheap is true, and fast is true, good luck
   if(newValue == 'true' &amp;amp;&amp;amp; g_form.getValue('u_cheap') == true &amp;amp;&amp;amp; g_form.getValue('u_fast') == true) {
      //Set the result field on the form.
      g_form.setValue('u_result', 'They are dreaming');
   }
   //repeat for the other scenarios
   else if (newValue == 'true' &amp;amp;&amp;amp; g_form.getValue('u_cheap') == true &amp;amp;&amp;amp; g_form.getValue('u_fast') == false) {
      g_form.setValue('u_result', 'Will take time to deliver');
   }
  else if (newValue == 'false' &amp;amp;&amp;amp; g_form.getValue('u_cheap') == true &amp;amp;&amp;amp; g_form.getValue('u_fast') == true) {
      g_form.setValue('u_result', 'Not the best quality');
  }
  else {
      g_form.setValue('u_result', 'Who knows');
  }
}&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Example 2: Open Dialog Window&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;:&lt;/P&gt;&lt;P data-unlink="true"&gt;I have a good example of a client script opening a&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;GlideDialog window here&amp;nbsp;.&lt;/P&gt;&lt;P&gt;I am just going to show the client script part. &amp;nbsp;In this example, a window pops up on form load&lt;/P&gt;&lt;P&gt;Client Script: SNE Message&lt;/P&gt;&lt;PRE&gt;function onLoad() {
 //Call a UI Page to Display on load.You have to create the UI Page separately
 var gDialog = new GlideDialogWindow('sne_message');
 gDialog.setTitle('ServiceNowElite.com Message');
 gDialog.setSize(700,700);
 gDialog.render();
}&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Example 3: Color Code Approval Buttons :&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;I use this one often. &amp;nbsp;Color code the approval buttons so that they are easier to notice.&lt;/P&gt;&lt;P&gt;It is tempting to use this for many color changes in ServiceNow. &amp;nbsp;How use&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://wiki.servicenow.com/index.php?title=Defining_Field_Styles" target="_blank" rel="noopener noreferrer"&gt;Field Styles&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;instead as much as possible.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screenshot 2026-05-13 104953.png" style="width: 593px;"&gt;&lt;img src="https://www.servicenow.com/community/image/serverpage/image-id/515958i05C518B5BA83A5E7/image-dimensions/593x24?v=v2" width="593" height="24" role="button" title="Screenshot 2026-05-13 104953.png" alt="Screenshot 2026-05-13 104953.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Client Script: Approval Button Color&lt;/P&gt;&lt;P&gt;When: onLoad&lt;/P&gt;&lt;P&gt;Script:&lt;/P&gt;&lt;PRE&gt;function onLoad() {
 var approveButton = document.getElementById('approve');
 var rejectButton = document.getElementById('reject');
 if (approveButton) {
approveButton.style.background='green';
approveButton.style.color='white';
 }
 if (rejectButton) {
rejectButton.style.background='red';
rejectButton.style.color='white';
 }
}&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Example 4: Verify a phone number :&lt;/STRONG&gt;&lt;/P&gt;&lt;P data-unlink="true"&gt;Before ServiceNow version Dublin was released, I used this to verify a phone number format. Dublin has new&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;phone number fields&amp;nbsp;.&lt;/P&gt;&lt;P data-unlink="true"&gt;However it is a good example of regex function. &amp;nbsp;If you are not familiar with regular expressions, here are some&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;explanations of what regular expressions&amp;nbsp;.&lt;/P&gt;&lt;P&gt;Client Script: Verify Number&lt;/P&gt;&lt;P&gt;Type: onChange&lt;/P&gt;&lt;P&gt;Field: u_phone_number&lt;/P&gt;&lt;P&gt;Script:&lt;/P&gt;&lt;PRE&gt;function onChange(control, oldValue, newValue, isLoading) { 
 if (isLoading || newValue == '') {
return;
 }
 var tempValue = newValue;
 //Use Regular Expressions to verify number
 var phoneRegex1 = /^\d{3}-\d{3}-\d{4}$/;
 var phoneRegex2 = /^(800|866|877)/;
 var phoneRegex3 = /^(1{3}-1{3}-1{4}|2{3}-2{3}-2{4}|3{3}-3{3}-3{4}|4{3}-4{3}-4{4}|5{3}-5{3}-5{4}|6{3}-6{3}-6{4}|7{3}-7{3}-7{4}|8{3}-8{3}-8{4}|9{3}-9{3}-9{4}|0{3}-0{3}-0{4})$/;
 
 if (tempValue.match(phoneRegex1) &amp;amp;&amp;amp; !tempValue.match(phoneRegex2) &amp;amp;&amp;amp; !tempValue.match(phoneRegex3)) {
return;
 }
 else {
g_form.setValue('mobile_number', '');
alert('Phone number must be in format XXX-XXX-XXXX and must not start with 800, 866, or 877.');
 }
}&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Example 5: Alert :&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Pop an alert to the screen if a value is true&lt;/P&gt;&lt;P&gt;Client Script: Awesome Check&lt;/P&gt;&lt;P&gt;Type: onChange&lt;/P&gt;&lt;P&gt;Field: u_awesome_check&lt;/P&gt;&lt;P&gt;Script:&lt;/P&gt;&lt;PRE&gt;function onChange(control, oldValue, newValue, isLoading) {
 if (isLoading || newValue == '') {
return;
 }
 if (newValue == 'mike_awesome') {
alert('Yes this is true');
 }
}&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Example 6: Adjust Slush Bucket Sizes :&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;There is a good example of adjusting slush bucket sizes from the forums.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE&gt;function onLoad(){
 var varName = 'YOUR_VARIABLE_NAME_HERE';
 var height = '10'; //Optional
 var width = '250'; //Optional
 //Get the left and right bucket input elements
 var leftBucket = $(varName + '_select_0');
 var rightBucket = $(varName + '_select_1');
 if(height &amp;amp;&amp;amp; g_form.getControl(varName)){
//Adjust the bucket length (default is 18)
leftBucket.size = height;
rightBucket.size = height;
 }
 if(width &amp;amp;&amp;amp; g_form.getControl(varName)){
//Adjust the bucket width (default is 340)
leftBucket.style.width = width;
rightBucket.style.width = width;
 }
 //Fix the expanding item preview issue
 $(varName + 'recordpreview').up('td').setAttribute('colSpan', '3');
}&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Example 7: Callback Function :&lt;/STRONG&gt;&lt;/P&gt;&lt;P data-unlink="true"&gt;Callback functions&amp;nbsp;&amp;nbsp;make JavaScript far more flexible than it would be otherwise.&lt;/P&gt;&lt;P&gt;Typical functions work by taking arguments as input and returning a result. &amp;nbsp;Functions take an input and return an output.&lt;BR /&gt;Javascript callback functions are different. &amp;nbsp;Instead of waiting for a function to return that result, you can use a callback to do this asynchronously. &amp;nbsp;This not only helps with performance, it strongly encouraged to use callback functions and asynchronous programming.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Example: without a callback (don't do this) :&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Client Script: Set VIP&lt;/P&gt;&lt;P&gt;When: onChange&lt;/P&gt;&lt;P&gt;Field: caller_id&lt;/P&gt;&lt;PRE&gt;function onChange(control, oldValue, newValue, isLoading) {
 var caller = g_form.getReference('caller_id');
 if (caller.vip == 'true')
alert('Caller is a VIP!');
}&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Example: with a callback (recommended)&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Client Script: Set VIP&lt;/P&gt;&lt;P&gt;When: onChange&lt;/P&gt;&lt;P&gt;Field: caller_id&lt;/P&gt;&lt;PRE&gt;function onChange(control, oldValue, newValue, isLoading) {
 var caller = g_form.getReference('caller_id', doAlert); // doAlert is our callback function
}
function doAlert(caller) { //reference is passed into callback as first arguments
if (caller.vip == 'true')
alert('Caller is a VIP!');
}&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Example 8: GlideRecord Query :&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;To learn all about client script GlideRecord queries. These are limited glide record queries you can use to make server-side database queries. They use callback functions to do this. I always suggest using business rules instead for these, but sometimes I can't convince people to do that.&lt;/P&gt;&lt;P&gt;It is better to use a GlideAjax query than a GlideRecord query. There is a good example in the wiki for that.&lt;/P&gt;&lt;P&gt;Client Script: Set Version&lt;/P&gt;&lt;P&gt;On Change Table: Configuration Item&lt;/P&gt;&lt;P&gt;Field Name: Product&lt;/P&gt;&lt;P&gt;Script:&lt;/P&gt;&lt;PRE&gt;function onChange(control, oldValue, newValue, isLoading, isTemplate) {

var gr = new GlideRecord('cmdb_ci');
 gr.addQuery('sys_id', newValue);
 gr.query(setVersion);
}

function setVersion(gr) {
 if (gr.next()) { 
 g_form.setValue('version', gr.u_version);
}
}&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Example 9: Remove Option from Choice List :&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;This is an easy client script. Remove a value from a choice list if something is set.&lt;/P&gt;&lt;P&gt;Client Script: Category Inquiry Remove Impact 1&lt;/P&gt;&lt;P&gt;When: onChange&lt;/P&gt;&lt;P&gt;Field: Category&lt;/P&gt;&lt;P&gt;Script:&lt;/P&gt;&lt;PRE&gt;function onChange(control, oldValue, newValue, isLoading, isTemplate) {

if (isLoading || newValue == '') {
return;
}
if (newValue == 'inquiry') {
g_form.removeOption('impact', '1');
}
}&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If my response helped mark as helpful and accept the solution.&lt;/P&gt;</description>
      <pubDate>Fri, 15 May 2026 05:19:21 GMT</pubDate>
      <guid>https://www.servicenow.com/community/community-central-forum/looking-for-more-use-cases-of-servicenow-scripting/m-p/3543433#M6897</guid>
      <dc:creator>yashkamde</dc:creator>
      <dc:date>2026-05-15T05:19:21Z</dc:date>
    </item>
  </channel>
</rss>

