Set date to a set field activity in a workflow
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-09-2020 03:45 AM
I have a requirement to set current time and tomorrow's date to a date-time field in a workflow.
Let say current time is 5 PM and date is 9th March. I have to set 10-03-2020 05:00:00.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-09-2020 04:11 AM
Hi Srini,
Are you saying you want to set it to next date and time as 5pm?
if yes then you can set that using script; you cannot set it to next date using set value activity since it would accept static value; use run script activity
Mark ✅ Correct if this solves your issue and also mark 👍 Helpful if you find my response worthy based on the impact.
Thanks
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-09-2020 04:47 AM
Hi,
You can use run script activity to set the date/time.
Script:
var start_date=current.variables.<<variable name>>; //replace the variable name
var gdt = new GlideDateTime(start_date);
gdt.addDays(1);
current.<<variable name>> = gdt;
If I have answered your question, please mark my response as correct and/or helpful.
Thanks,
Suseela P.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-09-2020 11:58 PM
You can use 'Set Values' activity in your workflow to set all the values.
Example-
In the 'Set Values' activity in your workflow you can use below-
Set -
Resolved - javascript:gs.nowDateTime()
Resolved By - javascript:gs.getUserID()
and so on.