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
  • 2
    Do you have the <script> tags in the js file stored in static resource? If yes then remove it and then try
    – Sam
    Commented Jun 12, 2015 at 7:21
  • I've removed the <script> tags and now it's working fine :)
    – user13277
    Commented Jun 15, 2015 at 6:15

1 Answer 1

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.

You must log in to answer this question.