Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Hide Start/Stop Timer on Record Table

## Purpose
Prevent users from clicking Start/Stop timer and letting it run while they are idle. The goal of this script was to encourage intentional time worked entries.

## How to Use
1. Create OnLoad client script (timeworkedhidetimer.js)
2. Adjust which table you want it on. In this case, it will be Incident table.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please add a sentence or two about why this needs to be done with DOM manipulation instead of g_form or other oob methods? Otherwise looks good.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From my understanding, this isn't possible using oob methods or g_form according to documentation I found. Happy to use those if there is a solution for it.

https://www.servicenow.com/community/developer-forum/automaticly-stop-time-worked-timer/m-p/1603232

https://servicenowguru.com/system-ui/pausetoggle-time-worked-field/

If DOM manipulation is illegal in the code snippets, I can close the pull request. I misunderstood the purpose of this project if that's the case.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, I think you're right that there's not a native method for this. I meant can you add some information in the readme and/or code comments stating that DOM Manipulation must be used for this. Just want to include extra context since DOM manipulation is usually not aligned with best practices.

Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
function onLoad() {

$j('div[id="element.incident.time_worked"]').children('.form-field-addons').hide();

//if you use other tables, just adjust the dot-walking element ie change_request.time_worked

}
Loading