質問に「本日から1ヶ月後の日付」を自動入力させる方法

Pirakawa
Tera Contributor

はじめまして。

ServiceNowでカタログを開いたとき、質問に「本日から1ヶ月後の日付」を自動入力させる方法が知りたいです。

スクリプトであれば、その内容まで知りたいです。

1 件の受理された解決策

@Pirakawa 

Hope you are doing good.

Did my reply answer your question?

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

元の投稿で解決策を見る

3件の返信3

senon
Tera Sage

カタログ変数の日付変数に対してデフォルト値を1か月後の日付を設定するにスクリプトに書くことで可能になります。

デフォルト値に入力するスクリプト

javascript:

var dateNextMonth;

var gdt = new GlideDateTime();

gdt.addMonths(1);

dateNextMonth = gdt.getDate();

dateNextMonth;

senon_0-1745372069757.png

 

 

 

Ankur Bawiskar
Tera Patron
Tera Patron

@Pirakawa 

something like this in the default value of the date variable

javascript: var dt; var gdt = new GlideDateTime(); gdt.addMonthsLocalTime(1); dt = gdt.getDate(); dt;

If it's date/time then use this

javascript: var dt; var gdt = new GlideDateTime(); gdt.addMonthsLocalTime(1); dt = gdt.getValue(); dt;

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

@Pirakawa 

Hope you are doing good.

Did my reply answer your question?

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader