- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-18-2016 07:13 AM
Hi
How can i set the value of a field(work start) to current Date Time based on another filed's value in a business rule action?
Regards.
Solved! Go to Solution.
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-18-2016 07:28 AM
Hi John,
Please see the link below.
Set date via business rule action
Regards,
Harshvardhan
PS - Please mark Helpful, Like, or Correct Answer if applicable.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-18-2016 07:19 AM
The unscripted method is to use "same as" for the operator.
If you want a scripted method, check the advanced button and use the script field with a line of code (in place of the comment) like this:
current.work_start = current.u_other_date_time_field;
If you want to set it to the CURRENT date:
current.work_start = gs.nowDateTime();
GlideSystem Date and Time Functions - ServiceNow Wiki
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-12-2018 09:52 PM
Not working in Jakarta version

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-13-2018 05:08 AM
Can you share your code, any error messages, and what context you are using it in? Example:
javascript:gs.nowDateTime() in a BR for a scoped app. <<-- This is a known issue and you'll get an error since this method isn't supported in scoped apps. You should be using GlideDateTime() in scoped, and global apps.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-13-2018 10:20 AM
Table:
Requested Item(sc_req_item)
Business Rule:
After - update
Condition:
state changes to resolve
Code:
//gs.addInfoMessage("Resolved field update=" +gs.nowDateTime());
current.u_resolved_on_date=gs.nowDateTime();
current.update();
As you said, even i tried with the GlideDateTime() as well, but no luck.