Auto populate Actual dates
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-01-2023 02:08 PM
Hi,
I am trying to auto populate actual start and end dates in project and project tasks when state changes to work i progress/ closed complete.
I set the before business rule and when state changes to closed complete.
var now = new GlideDateTime();
current.work_end = now;
But the issue is when I am trying change the state to closed complete the actual end date populating with some other date and when I saved it the is date is overriding, that' not correct. I want the current datetime to be populate before save and a user wanted to edit it, it should not allow them to save it with the future date. Please help me what business rule do I need to deactivate, I am new service now scripting..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-01-2023 02:58 PM
Hi @Yamja ,
You can use this particular line of code in your business rule to populate the 'work_end' field with the current date
current.work_end = gs.nowDateTime();
If my answer has helped with your question, please mark it as helpful and correct.
Thanks!!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-01-2023 06:11 PM
Hi Karan,
I tried this business it is getting the current stamp when I change the date, but I want this to be before save.
Please see the above screeshot the actual start is not populating before I save it, that's getting confusion when users select the date and save it, it will override by my business rule. It has to populate before save and users should unable change it. Please let me know is there any BR that stopping this auto pop.
they want it to be like above screeshot but with curren time stamp.