Developer forum
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Forum Posts

get number of days between 2 dates

I have 2 dates in on form and calculated field. i have to get number of days between 2 dates. I wrote a script but its returning 20 days. I need only the count not 'days' word. Can anyone help me.

Hareesha by Tera Contributor
  • 730 Views
  • 3 replies
  • 0 helpfuls

Resolved! Restrict user to select past date in catalog item

Hi All, How to restrict the user from selecting past dates. I used below methods for restricting user from selecting past dates. It works fine if use past date of current month. And doesn't work for previous and future months. i,e if current date is ...

Property or Attribute for sp-date-picker

Hello Everyone, I wanted to know whether we have any default property or attribute to reverse or change the format of the sp-date-picker in the servicenow widget.Currently we have YYYY-MM-DD format, but I want to have in DD/MM/YYYY format. Could anyo...

Srinivas_S by Tera Contributor
  • 1056 Views
  • 1 replies
  • 1 helpfuls

Resolved! Script Action to add work notes to Change Request?

I have a question on the best way to create work notes on a Change request based upon a Run Script Action in the Change workflow.  This is the code for the Change Work Flow Run Script Action  if (workflow.scratchpad.sendmail===undefined){ var gr = n...

Tom Siegel by Kilo Guru
  • 4898 Views
  • 6 replies
  • 0 helpfuls

Display current date and time

Hello, I have a read only Date/Time field that I would like to default showing the current date and time. I have tried adding the below as the default value but doesn't seem to work: javascript: new DateTime(); 

Andre8_0-1679519030366.png
Andre8 by Giga Guru
  • 1930 Views
  • 3 replies
  • 1 helpfuls

Resolved! Publishing articles through an API

I am looking for a way to either create articles in a "published" state, or trigger the "publish" workflow through the REST API. I wrote a little PowerShell snippet that is creating the articles in "draft":   $serviceNowCredential = Get-Credential $u...

mhashemi by Mega Sage
  • 1832 Views
  • 1 replies
  • 2 helpfuls

Resolved! Remove attachments that are 30 days old

Hello experts, please I need your help, I need to create a scheduled job that will delete all attachments except the content type that is not an image.I got this from another post:tested it with a single incident, used the sys_id from the incident an...

JesusNava_0-1679597646531.png JesusNava_1-1679597678750.png
Jesus Nava by Tera Guru
  • 1234 Views
  • 3 replies
  • 1 helpfuls

Resolved! Info message on the form

Hi, We have a form backed by a table. One of the field in this form, 'Meeting link' is being populated by consuming a third party REST APIs which is written in an 'asyc' Business Rule. Now, our objective is to populate an informative message on the p...

Amit160 by ServiceNow Employee
  • 11932 Views
  • 10 replies
  • 8 helpfuls