Sage CRM 7.2 Client Side API Adding columns to List at Runtime

By | April 29, 2014

Sage CRM 7.2 introduced a new powerful and simple way to use API for carrying out client side customizations. In my previous blog I had explained how we can hide and show fields using Client side API.  Below is the link for the same.
New way of Client side field customizations
In this blog I will explain how we can add new column to the list block at runtime using Client Side API.
The New Stuff:User Administration and Info Admin Rights
Suppose we want to add “Lead Source” column on the lead list in MY CRM Leads tab at runtime. We can achieve the same by using “addColumn” method of Client Side API. To do the same follow below steps.
1. Login to CRM.
2. Go to Administration || Customization || Lead || Lists
3. Click on hyperlink of “Lead List”.
4. In the Custom Content write below code and save.
 <script>
crm.ready(function()
{
crm.grids(“0”).addColumn({index:0,columnName: “ Lead Source”});
})
</script>
The “addColumn” method has following 2 parameters.
1. Index: Specifies the position to insert the column.
2 .columnName: A string containing the name of the column.
 Happy Scripting!
Also Read:
1) SageCRM 7.2 URL parameters through Client Side API
2) Getting key value to be added in URL from client side script
3) Handling URL’s in COM API part 1
4) Handling URL’s in COM API part 2
5) XML based Fusion Charts using .NET API