Get Active tab through Client side scripting

By | September 17, 2014

In Sage CRM customizations, client side scripting has been proved beneficial to web developers in many ways. We have discussed several ideas on Client side scripting throughout the blog site. Today I will discuss one more such development trick.
New Stuff:  CRM Email Manager Service failed to start
For one of our customers, we had a requirement of executing a customized code as soon as user lands on Calendar tab after logging in. We were able to achieve this for every first time when user used to login to CRM but the code used to fail when user navigates back to Calendar tab from some other tabs. For this logic we were identifying “Act” parameter in URL, however in above scenario Act itself was changing.
On checking the code for the required tab in URL, I was unable to find any control which could help me to identify that I am on Calendar tab. This led me to go for slight coding through Client side script. I had to get the code of tab active in CRM through below lines of code.
<snippet>
<script language=’javascript’>
crm.ready (function ()
{
var sActiveTab = $(“td.TABON”).html();
})
</script>
</snippet>
As now I have the tab control I can execute my code only when that tab is loaded.
Also Read:
1) Linked selection fields through client side scripting
2) Quick Tip: Hyperlinking inside Your Notes in Sage CRM
3) Table Level Scripts Logging and Performance
4) Client Side API to hide and show Column of grid
5) Getting key value to be added in URL from client side script