
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-09-2019 03:08 PM
I have a date variable in a record producer. How would I set the default date to 10days in the future?
Solved! Go to Solution.
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-09-2019 05:09 PM
Hi Ray,
You would need to set the default date in the Record Producer Variable.
Key in this value in the default value field of the variable.
javascript:var dt = new GlideDateTime();dt.addDays(10);dt.getDisplayValue();
Refer to screenshot below:
You should see the field populated as below:
Please mark helpful, if it did indeed
Thanks,
Tej

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-09-2019 05:09 PM
Hi Ray,
You would need to set the default date in the Record Producer Variable.
Key in this value in the default value field of the variable.
javascript:var dt = new GlideDateTime();dt.addDays(10);dt.getDisplayValue();
Refer to screenshot below:
You should see the field populated as below:
Please mark helpful, if it did indeed
Thanks,
Tej

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-09-2019 06:09 PM
Thanks, Tej. That's exactly what I was looking for and it works brilliantly.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-11-2019 07:36 AM
Hi Tej,
I'm wondering if you can help with a follow on question linked to this. Now I have set the date to something in the future I need to make this read only so the user completing the form cannot change the date.
Thanks.
Ray

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-11-2019 08:26 AM
Hi Ray,
You could make use of the Catalog UI policies to be able to do this.
In the Catalog UI policy, you could include the conditions on when you would want the field to be read-only.
Once the UI policy is created, you would have to create a UI policy action for that field.
You could refer to this link: Create UI policy for Catalog Items
Please mark helpful, if it did indeed.
Thanks,
Tej