Set field length at run time in Sage CRM

By | January 14, 2013

There are different types of fields in Sage CRM. Well obviously we can change/set the field length as per our convenient and depending upon the data that would be user filling while entering the data.
Suppose we need to change the field length then you need to do refer the below link.
Alternate way would be to change the same from SQL by executing the necessary queries.
Can it be done at a runtime? Well, the answer is yes. For example, we can set person private email address field length at run time. To do the same we need to follow the below steps:

  1. Create a ClientFunctions.js file in the custom pages folder.
  2. Add the below code in the ClientFunctions.js file.
    function setLength()
    oEmailPrivate = document.EntryForm.emai_emailaddressprivate;
    oEmailPrivate.maxLength = “50”
  3. Navigate to Administration|Customization|Translations
  4. Check the Translation inline mode checkbox.
  5. Go to the Person phone email tab.
  6. Click on the Email_and add the below code in the US and UK translation of the same.
    Email< script language=javascript src=”..\CustomPages\ClientFunctions.js” >
    < /script >
    < script >
    window.attachEvent(“onload”, setLength)
    < /script >
  7. Click on the Save button and disable the Inline translation mode.
  8. Log off Sage CRM.
  9. Log in again to check the same.

You can do all the above mentioned steps to set length of any field at a runtime.