- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-21-2023 07:17 PM
Hello,
I have 2 variables for a specific request item that should be auto populate.
Valid from should be auto populate on the date of creation/submission.
Valid to is dependent to Validity.
If I select 1 week, the Valid to date should automatically populated based on the user’s selection.
How can I configure that kind of setup?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-21-2023 10:37 PM
I tried to add this on default value javascript:gs.nowDateTime() and it worked.
My problem now is the Valid to.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-21-2023 07:47 PM
auto-populate based on which variable?
Is that variable a reference variable?
If yes then you can use Utah's auto-populate feature with no scripting
Auto-populate a variable based on a reference type variable (Utah)
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-21-2023 08:24 PM
Hi @Ankur Bawiskar ,
Valid from and Valid to are the variables which the type is Date/Time
Let's say I will a submit, the Valid From should be auto populate on the day I will submit a request.
And for Valid to, If I select on the 1 week on the Validity, the Valid to should be 1 week from the Valid from.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-21-2023 09:07 PM
are you having target fields for those 2 variables?
If yes and since you want to auto-populate the target fields the variables are not required as they won't be entered by user and will be calculated from script
you can use record producer script to set the value in target field
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-21-2023 10:37 PM
I tried to add this on default value javascript:gs.nowDateTime() and it worked.
My problem now is the Valid to.