Time Card Adding Notes
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-25-2025 07:39 AM
The Time Sheet Portal currently allows users to add notes to time cards within the time sheet. We’ve received a request to automatically transfer the note entered on a time card for a specific project or project task as a work note to the corresponding project or task record. Is this functionality possible to implement? If so, could you please provide guidance on the best way to achieve this?, thank you
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-25-2025 09:47 PM
Hi @ismad400 ,
The best way to achieve it would be using business rules, you can create a 'after' business rules on 'time card' table with condition as :
In the script you can query "Project" or "Project task" on the basis of what is selected in the task field. You can update the notes to the task work notes.
Please mark the answer helpful clicking on 👍 and correct if it helps the issue. Happy scripting 🙂
-Shantanu
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-26-2025 01:11 PM - edited 05-27-2025 06:55 AM
To finish what was started above, a script follows, Advanced must be check on the BR to use it.
(function executeRule(current, previous /*null when async*/) {
// get journal field value
var notesValue = 'Not Found';
var jNotes = new GlideRecord('sys_journal_field');
jNotes.addQuery('element_id', current.sys_id);
jNotes.addQuery('name', 'time_card');
jNotes.orderByDesc('sys_created_on');
jNotes.query();
if (jNotes.next()) {
notesValue = jNotes.value;
}
// now find the related task
var tsk = new GlideRecord('task');
tsk.addQuery('sys_id', current.task);
tsk.query();
if (tsk.next()) {
// Create new journal entry
// gs.addInfoMessage("task Table: " + tsk.sys_class_name + " sys_id: " + tsk.sys_id);
var sjn = new GlideRecord('sys_journal_field');
sjn.initialize()
sjn.element_id = tsk.sys_id;
sjn.name=tsk.sys_class_name;
sjn.value = notesValue;
sjn.element='work_notes';
var rslt = sjn.insert();
// gs.addInfoMessage('update result: ' + rslt);
}
})(current, previous);