Remove unwanted Phone-Email fields Part 2

By | November 3, 2012

In my previous blog I had explained how this can be done in standard way.
https://www.greytrix.com/blogs/sagecrm/2012/10/20/remove-unwanted-phone-email-fields/
Bu what if you want to just hide the unwanted fields in the Phone/Email tab and not remove them?  Same can be done by implementing JavaScript as explained below.
Here are the installation instructions.
1. Create a ClientFuncs.js file in the custom pages folder.
2. Add the below code in the ClientFuncs.js file.

function PhoneEmailOnload()

{

            PersonPhoneOnLoad();

}

function PersonPhoneOnLoad()

{

            if(document.EntryForm)

            {

                        //’to hide the caption name

                        var navlinks = document.getElementsByTagName(‘TD’);

                        for (var i = 0; i < navlinks.length; i++)

                        {

                                    if(navlinks[i].className==”VIEWBOXCAPTION”)

                                    {          

                                                LinkTo = navlinks[i].innerText;

                                               

                                                if(LinkTo==”Pager:”  || LinkTo==”Pager*:”)

                                                {

                                                            navlinks[i].innerText=”;

                                                }

                                               

                                    }                                  

                        }

                        //’To hide all the control of toll free phone number

                        if(document.EntryForm.phon_countrycodepager

                        && document.EntryForm.phon_areacodepager

                        && document.EntryForm.phon_numberpager )

                        {

                                    hidePhoneIt(‘phon_areacodepager’);

                                    hidePhoneIt(‘phon_numberpager’);

                                    hidePhoneIt(‘phon_countrycodepager’);

                        }

                        else if(document.getElementById(‘phon_areacodepager’)

                        && document.getElementById(‘phon_numberpager’)

                        && document.getElementById(‘phon_countrycodepager’))

                        {

                                    hidePhoneIt(‘phon_areacodepager’);

                                    hidePhoneIt(‘phon_numberpager’);

                                    hidePhoneIt(‘phon_countrycodepager’);

                        }

            }

}

//’to hide the pager field

function hidePhoneIt(theElementId)

{

            document.getElementById(theElementId).style.display=’none’;

}

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 Phone_ and add the below code in the US and UK translation of the same.

Phone< SCRIPT language=’javascript’ src=’../custompages/ClientFuncs.js’>

</ SCRIPT >

<SCRIPT language=”javascript”>

window.attachEvent(“onload”,PhoneEmailOnload)

</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.