
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-03-2022 02:40 AM
Hello All
I have a date/time field which I would like to be set to three days from now as default when a ticket goes into Pending Customer.
How can I achieve this ? Can I put a default value in the dictionary field or should I use a client script ?
Thanks
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-04-2022 02:04 AM
Hello @Jerome MAISETTI
You can use the below script in Before Update BR:
Condition: State is on Hold AND On hold reason changes to Pending Customer
Before update BR Script:
var nowGDT = new GlideDateTime();
nowGDT.addDays(3);
var nowDateNumericValue = nowGDT.getNumericValue();
current.<your_date_time_field_name>.setDateNumericValue(nowDateNumericValue);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-03-2022 02:44 AM
@Jerome MAISETTI The right way is to setup an onbefore business rule based on your condition as States changes to Pending Customer and write the GlideDateTime script in it to set your field.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-04-2022 02:04 AM
Hello @Jerome MAISETTI
You can use the below script in Before Update BR:
Condition: State is on Hold AND On hold reason changes to Pending Customer
Before update BR Script:
var nowGDT = new GlideDateTime();
nowGDT.addDays(3);
var nowDateNumericValue = nowGDT.getNumericValue();
current.<your_date_time_field_name>.setDateNumericValue(nowDateNumericValue);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-04-2022 02:54 AM
Hi,
You cannot use default value in dictionary. Default value in dictionary is meant to be used only once when new record is getting created.
you can use BR approach shared by Mahendra.
Can you share what script did you try so far and what's not working?
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-17-2025 12:02 PM
I'm trying to set a future date as the default value in a field, but when I use javascript:now(); it populates the present date instead. How do I do it correctly?