Auto-saving feature for Customized Entity

By | July 30, 2016

Recently, one of our customer asked us to add Auto Save feature in Sage CRM so with the help of JavaScript we enabled this. This feature will auto save the users data on pressing the Enter key.
Open Cases Summary Report to Managers.
Create a custom page and add the below code to get this working.

function TrapEnterKey()
{
document.onkeypress = HandleKeyup;
}

function HandleKey(e)
{
var keyCode=””;
if(!e)
{
keyCode = window.event.keyCode;
}
else
{
keyCode=e.which
}
if(keyCode == 13) // code for ‘ENTER’ key
{
document.getElementById(‘Button_Save’).click();
}
}

Call the “TrapEnterKey” function on page load event and see the effect of AutoSaving feature for custom entity in SAGE CRM.
One more thing can be done in such scenario. We can stop the page refresh activity on pressing the ‘ENTER’ key rather than AutoSaving. For this, you can use the below method-

window.stop(); // For Chrome
OR
document.execCommand(“Stop”); //For Internet Explorer

Also Read:
1. JavaScript to print Amount (In Words)
2. JavaScript to Calculate days difference between dates (Duration)
3. Get Active tab through Client side scripting
4. Client Side API to hide and show Column of grid
5. Display Current User Name under Custom Tab using jQuery