- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-08-2017 01:33 PM
In knowledge in Istabul.
i want to set the Valid To date to default to one year from created. Presently, the default is to set it to 2020. This is done by a dynamic filter list
which looks like this
var d = new GlideDate(); d.setValue('2020-01-01'); d.getDisplayValue();
How could i use a dynamic filter list or some other option to set this field to be a year when article is submitted. Just like it i
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-09-2017 03:51 AM
This is worked
1. Right click on the 'Valid Field'
2. Click on personalize Dictionnary
3. On default Value tabs, write the script below (ensure that the 'Use dynamic default is unchecked) :
javascript: var dat = new GlideDate(); dat.setValue(gs.monthsAgo(-12));
dat.getDisplayValue();
4. Save

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-08-2017 04:26 PM
it's not best practice to use default value unless you have this kind of requirement.
Here, requirement is to update values on insert, update where BR need to be used.
Regards,
Sachin

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-08-2017 04:02 PM
Business rule is better for CRUD transactions.
Regards,
Sachin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-09-2017 03:59 AM
Wouldn't a client script be a better action then?
Only if you want it to run every time the form opened (or a form value changed).
If you wanted to set the default for a blank field upon record creation, a BR or Dictionary Default is intended for this task.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-09-2017 06:10 AM
Yes, i should of stipulated it is only when the form is created. All other times we will have a workflow update this field.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-08-2017 04:39 PM