New way of Client side field customizations

By | November 5, 2013

SageCRM has always been open for good lot of client side customizations for the fields added on several blocks like Lists, Screens etc. When it comes to client side screen customization one thing that comes to our mind is the EntryForm and so is the old way of referring field objects.
var  oField = document.EntryForm.<field name >
Now as we had the field object we used to write whole lot of complex functions in order to do simple customizations like Hiding and Showing fields like the one explained in my blog below.
Related Post Hide and Show fields in SageCRM
Now with the introduction of new client side API these things have become fairly simple. You have got the CRM fields collection to get field objects and you can utilize power of jQuery to do complex client side scripting for all your needs.
Here is the script which does the same thing explained in above blog post but using new client side API.
<script>
//’Call to onlaod event
window.attachEvent(“onload”,Page_OnLoad);
 //’Onlaod event definition
function Page_OnLoad()
{
         //’Hide field
         crm.fields(“oppo_description”).hide();
         //’Show it
         crm.fields(“oppo_description”).show();
}
</script>
I think there is no need of explaining that this has to be put on the Custom Content section of Opportunity Summary Screen.
One more thing every reader should keep in mind while hiding any field on screen is, the field you are hiding should not be mandatory. Otherwise you will get validation error and won’t even know what is it :).
Happy scripting!
Also Read:
1) How to remove Arrow button of Search Select Advanced field
2) Add custom button using Access Key in Sage CRM
3) Remove hyperlink from summary caption tags
4) Error while writing scripts on OnChange script section
5) Javascript popup window