- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-09-2022 09:52 PM
Hello Guys,
When ever a record gets inserted on incident table a datetime field is populated with current date and time.
I have a field on the incident form which has type date/time.
For that I have created the Before Business rule of insert type. Below is my code:-
// Add your code here
var dateTime = new GlideDateTime();
current.setValue('u_request_received_date',dateTime);
current.update();
Now I don't want to use current.update() method. And if I remove this, it does not work.
Please help me with this one 😞
Note: I need to use only Business Rule.
Solved! Go to Solution.
- Labels:
-
Incident Management
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-09-2022 10:03 PM
Hi,
If you use before insert business rule which you are already using then no need of current.update();
Regards
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
‎06-09-2022 10:09 PM
Hi @Ankur Bawiskar I have already tried just by removing current.update(). But it was not working. If I use current.update() its working
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-09-2022 10:20 PM
Hi,
your BR should have Before type and Insert - True
Share your BR configuration screenshot
regards
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
‎06-09-2022 10:13 PM
For before BR, update() is not needed, if at all you have any issues with this.
Try setting default value for the field at dictionary level, Configure dictionary, Default Value section:
javascript: gs.nowDateTime();
Aman Kumar