- Subscribe to RSS Feed
- Mark as New
- Mark as Read
- Bookmark
- Subscribe
- Printer Friendly Page
- Report Inappropriate Content
No doubt that ServiceNow is good tool, but sometimes a good thing is missing something very much important. Like this, many developers are missing a very basic functionality that they use a lot while developing stuffs i.e old functionality for saving stuffs "CTRL+S" or "MetaKey+S". Let us present you one Utility :SaveNow.
Developer Utility — SaveNow
At inMorphis, we have developed a utility SaveNow, which we use to save scripts. This is a small utility that saves a lot of time. Previously, developer used to save via "RIGHT CLICK" but now we use this utility.
Basic idea is to create a global UI Script that will capture the key events and trigger UI Action to save scripts.
Create a new UI Script.
UI Script: SaveNow
Global: true
Active: true
Script:
- /*
- Add Event Listener on key down event for CTRL+S
- */
- document.addEventListener("keydown", function(event) {
- //keycode 83 is for s
- //identify main key ==> metakey || ctrlkey
- if ((window.navigator.platform.toUpperCase().indexOf('MAC')>=0 ? event.metaKey : event.ctrlKey) && event.keyCode == 83) {
- //Get the event value, "event.which" is for FF
- event=event||window.event||event.which;
- //Prevent the dafault function called by CTRL+S
- event.preventDefault();
- //Get full element of the form
- var _form=g_form.getFormElement();
- //Get the sys_id value from the URL to check which UI Action needs to be called
- var _sys=getParameterFromURL("sys_id").toString();
- //Based on value of sys_id, we will decide that which UI Action needs to be called, either for insert or Update
- var _btnAction=_sys=="-1"?"sysverb_insert_and_stay":"sysverb_update_and_stay";
- //call the UI Action
- gsftSubmit(null, _form, _btnAction);
- }
- }, false);
You can also copy this code form github repository or download the UpdateSet from github.
Let us know, IF you are facing any issue while using this UpdateSet.
To read more such interesting posts. Click here
----
visit www.inMorphis.com/blogs/ for more
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.