SageCRM 7.2 URL parameters through Client Side API

By | April 11, 2014

In Sage CRM customizations most of the times we need query string (URL) parameters to be used in the code. As far as server side programming is concerned, there are several ways by which we can get URL values and use them. Complexity increases when it comes to client side scripting. One needs to write code which parses URL and extracts required value from it. Is there an easier method? YES, there is.
Related Post: New way of Client side field customizations
Client side API introduced in SageCRM 7.2 onwards is something I like to call a treat for developers which reduce lot of customization efforts. Through client side API, 2 new functions were introduced named “getArg” and “getArgs”. These functions help making work with URL’s very easy.
Here is how I get the Querystring parameters (e.g. ACT) from URL using this method.
<script language=’javascript’>
crm.ready(function () {
            var sAct=crm.getArg(“Act”,crm.url());
            if(sAct==”” || sAct==”undefined” || sAct==null)sAct=””;
Similarly you can use getArgs function which returns object which has query string values.
Also Read:
1) Error on Sage CRM 7.2 Find Screens
2) Outlook Integration – Uninstalling integration setup from Outlook
3) IIS Security in Sage CRM v7.2