Mask a Text Field into Time Format (MM:SS) using jQuery

By | March 16, 2017

As we all know, SAGE CRM provides different types of field’s such as Selection, Multi-select, Search Select Advanced, checkbox, Textbox, multiline text, Currency, Integer, decimal, etc. so that we can input our data as required, but in CRM there is no provision to input values in time format. Using jQuery you can easily achieve the same. JQuery has taken up the Sage CRM customization to the higher level as it has wide range of built in functions as well as its syntax. In this blog, I will explain how to change input behaviour of a simple text field into time format i.e. in MM:SS (Minutes: Seconds) by using jQuery.

New Stuff: Migrate Case from Salesforce to Sage CRM

One of our clients came up with the requirement to make such a text field in which user can capture the overall call duration in the form minutes and seconds. With the help of jQuery functionality we had successfully implemented client’s requirement. Below is the screen shot for your reference of exactly what we are going to achieve in this blog –


Text Field with Time Format

Text Field with Time Format

Follow the below steps to convert the text field into time format – 

1. One way is to download the masking code from the URL “https://digitalbush.com/wp-content/uploads/2013/01/jquery.maskedinput-1.3.1.min_.js ” and save the code as your new js Page (say jQueryPage.js) at below path InstalledDrive\ Program Files (x86)\ Sage\ CRM\ <InstanceName> \ WWWRoot\ CustomPages\ Script

2. Other way is by giving page reference SRC as “http://digitalbush.com…” in Custom Content of your data entry screen. For example, Case entry screen. Refer below screen shot for your reference.

Javascript Code snippet 1
Javascript Code snippet 1

3. If you are going with the first step then call the js page created in first step in the Custom Content of your data entry screen. For example, Case entry screen. Refer below screen shot for your reference.

Javascript Code Snippet - 2
Javascript Code Snippet – 2

Once you are done with above steps, jQuery utility will apply the masking feature as MM:SS on respective text field. After applying this, it will allow only numeric values to be entered as input. As shown in the given screenshot.


Time value in MM:SS format

Time value in MM:SS format

In this way, you can easily mask text field into time format. Similarly, you can also mask text field into Date format as well by replacing “99:99” to “99/99/9999” in custom content code. You can use different date formats like  dd/mm/yyyy or dd-mm-yyyy. Refer the below code for your reference.

                                   $(“#case_ticketcallduration”).mask(’99/99/9999′);

A beautiful functionality by jQuery mechanism. Enjoy Scripting..!!

About Us
Greytrix a globally recognized Premier Sage Gold Development Partner is a one stop solution provider for Sage ERP and Sage CRM needs. Being recognized and rewarded for multi-man years of experience, we bring complete end-to-end assistance for your technical consultations, product customizations, data migration, system integrations, third party add-on development and implementation expertise.

Greytrix has some unique integration solutions for Sage CRM with Sage ERPs (Sage Enterprise Management (Sage X3), Sage Intacct, Sage 100Sage 500 and Sage 300).We also offer best-in-class Sage ERP and Sage CRM customization and development services to Business Partners, End Users and Sage PSG worldwide. Greytrix helps in migrating of Sage CRM from Salesforce | ACT! | SalesLogix | Goldmine | Sugar CRM | Maximizer. Our Sage CRM Product Suite includes Greytrix Business Manager, Sage CRM Project Manager, Sage CRM Resource Planner, Sage CRM Contract Manager, Sage CRM Event Manager, Sage CRM Budget Planner, Gmail Integration, Sage CRM Mobile Service Signature and Sage CRM CTI Framework.

Greytrix is a recognized Sage Rockstar ISV Partner for GUMU™ Sage Enterprise Management – Sage CRM integration also listed on Sage Marketplace.

For more information on our integration solutions, please contact us at sage@greytrix.com. We will be glad to assist you.