How do i configure a date/time field that fetch the date where the risk event is in analyze stage
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-23-2025 10:43 PM
Dear experts,
I try to create a date/time field called analyze start date and create a new business rule to fetch the date where the state changes to Analyze and before update. The execution script is as below, but it does not work as it won't show any date data. What do i need to do to make it work?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-23-2025 10:53 PM
Seems your business rule condition is not working
I will suggest to use business rule filter condition for this and simply use this script
current.u_analyze_start_date = new GlideDateTime();
OR
try this
(function executeRule(current, previous) {
if (current.u_analyze_start_date == '' && current.state.toString() == '2') {
current.u_analyze_start_date = new GlideDateTime();
}
})(current, previous);
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
02-23-2025 11:00 PM
Hi Ankur,
Thanks for the response but the script u suggested still does not work.