Worknotes related
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
5 hours ago
hi
When a user with username Nscintegprod.ser adds worknotes in Incident, i need to update the field u_acknowledged_date with the date and time when the user adds the comment how can we do that?
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
4 hours ago
Hi Abdul,
Create a Business Rule:
- Table: incident
- When: before (or after, depending on your needs; before is safer for field updates)
- Update: true
Business Rule Conditions:
You can optionally set a condition like:
- Work notes changes: current.work_notes.changes() == true
Script:
if (current.work_notes.changes()) {
// Check if the user is 'Nscintegprod.ser'
if (gs.getUserName() == 'Nscintegprod.ser') {
current.u_acknowledged_date = new GlideDateTime(); // sets to current date/time
}
Thank you,
Vignesh Parthiban
If you feel the solution is working, please mark it as accepted.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
4 hours ago
Hi @Abdul ,
For this requirement you need to create Business rule-
Go to:-- System Definition → Business Rules → New
- Configuration:
- Field Value
- Name Set Acknowledged Date from Work Note
-Table incident
-When before
-Insert true (checked)
-Update true (checked)
-Advanced true (checked)
-Condition (leave blank or optional if needed)
and write down the script -
(function executeRule(current, previous /*null when async*/) {
// Check if user is 'Nscintegprod.ser' AND work_notes field is updated
if (gs.getUserName() === 'Nscintegprod.ser' && current.work_notes.changes()) {
current.u_acknowledged_date = new GlideDateTime(); // Set current date/time
}
})(current, previous);
if my response is helpful please mark as helpful and accept the solution
Thank you!!