Skip to main content

Posts

Showing posts from February, 2025

ServiceNow check that the date on a ticket is greater than today's date

 ServiceNow check that the date on a ticket is greater than today's date var iTodaysDate = gs.now(); var sTodaysDateTimeZero = new GlideDateTime (iTodaysDate.toString()); var iTodaysDateTimeZero = sTodaysDateTimeZero.getNumericValue(); var sACRdate = new GlideDateTime (requestGr.scheduled_start.toString()); var isACRdateTimeZero = sACRdate.getNumericValue(); var bFuture = (isACRdateTimeZero > iTodaysDateTimeZero);

Why is oldvalue not accessible in a catalog client script?

  Apparently OldValue is the value the field held on initial load, and not updated for each time the onChange client script runs (i.e. each time you change the selection). see  https://www.servicenow.com/community/developer-forum/how-to-get-oldvalue-in-an-onchange-catalog-client-script/m-p/1761324 https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0711972

Write a HTML table as an additional comment to a RITM

          var table_html = '<table style="width: 90%; margin: 20px auto; border-collapse: collapse;">' ;         var rowIndex = 0 ;         // Add table headers with styles         table_html += '<thead><tr style="background-color: #0F52A2; color: white; font-weight: bold;">' +             '<th style="padding: 10px; text-align: left;">Name</th>' +             '<th style="padding: 10px; text-align: left;">Value</th>' +             '</tr></thead>' ;         for ( var key in json) {               if (json.hasOw...