1

I have written a javascript function whose purpose is to open a case in a primary tab.The idea is to access this function in VF Page through but i'm unable to do it.When i'm opening the page microsoft script editor it's giving me compilation error in line no. 1.Can anyone point out to me what's wrong in this js code? (BTW this one is working fine when i'm including the code inside the VF Page)

<script type="text/javascript">
        function openCase(caseId) 
    {
            if(sforce.console.isInConsole()) 
       {
                sforce.console.openPrimaryTab

(null,'/'+caseId,true);
            }
            else 
        {
                window.open('/'+caseId);
            }
            return false;
        }
</script>
  • 2
    Do you have the <script> tags in the js file stored in static resource? If yes then remove it and then try – Sam Jun 12 '15 at 7:21
  • I've removed the <script> tags and now it's working fine :) – user13277 Jun 15 '15 at 6:15
0

The order you have the scripts listed on your page is important. All the basic JS code scripts have to load first before your new script loads. Your new script has to be the last script in the list of static resources on your page so that it's the last one called.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy