function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
NM AdminNM Admin 

This page has an error. You might just need to refresh it. First, would you give us some details? (We're reporting this as error ID: -1174688501)

Hello There,

I have a VF Page which is getting called from the related list button(custom list vf page button) added to the Account's related Case. 

Error: User-added image

Please find the below code snippet of the vf page:
<apex:page standardController="Account">
     <apex:includeScript value="/support/console/47.0/integration.js"/>
    <script src="/soap/ajax/20.0/connection.js" type="text/javascript"></script>
     <script src="/soap/ajax/33.0/apex.js" type="text/javascript"></script>
    <!--A HREF="#" onClick="RefreshPrimaryTab();return false">
        Click here to get the primary tab IDs</A--> 
    
    <script type="text/javascript">
    debugger;
    sforce.connection.sessionId = '{!GETSESSIONID()}';
        var accountid ='{!Account.Id}';
       var results = sforce.connection.query("select Id,Name from Account where Id='{!Account.Id}' limit 1");
       var accountRecords = results.getArray("records");
    var currentURL= 'http://www.salesforce.com';
     window.onload = function(){
         console.log('onload');
        redirect();
         }
     function redirect(){
debugger;     	
         console.log(UITheme.getUITheme());
         
         if(UITheme.getUITheme() === 'Theme4d' || UITheme.getUITheme() === 'Theme4u' || UITheme.getUITheme() === 'Theme4t'){
                sforce.one.navigateToSObject(accountid,"detail");
                sforce.one.createRecord('Case', null, {
                    'AccountId':'{!Account.Id}',
                     'Status':'New',
                     'Origin':'Phone'
                });
                if(UITheme.getUITheme() === 'Theme4u'){// Lightning Console
                    //alert('in ltng');
                   debugger;
                    testCloseTab();
                }
            }
            else{
                
                if (typeof(srcUp) == 'function') {
                    alert('in srcUp');
                    sforce.console.getEnclosingPrimaryTabId(openSubtab);
                    //testCloseTab();
                }
                else {
                      window.open(currentURL,'_self');
                    
                }                
            }
         
     }
    	
        
        var openSubtab = function openSubtab(result) {
            //Now that we have the primary tab ID, we can open a new subtab in it
            alert('in sub tab '+result.id+ '  currentURL '+currentURL);
            var primaryTabId = result.id;
            sforce.console.openSubtab(primaryTabId , currentURL, true,'New Case', null, null, 'salesforceSubtab');
        };
        
        function testCloseTab() {
            //First find the ID of the current tab to close it
            sforce.console.getEnclosingTabId(closeSubtab);
        }
        
        var closeSubtab = function closeSubtab(result) {
            //Now that we have the tab ID, we can close it
            var tabId = result.id;
            sforce.console.closeTab(tabId);
    
    </script>
</apex:page>

The code was working fine previously. But after enabling summer 20 we are getting this problem on the button click. 

Is there any issue with my code?


Welcome to your suggestion!


Regards,
Nilesh
AbhishekAbhishek (Salesforce Developers) 
Hi Nilesh,

Can I have organisation ID where the issue is facing so that I can check internally and let you know what caused this issue?

Abhishek Mudireddy
Salesforce Support.
NM AdminNM Admin
@Abhishek Thanks for quick reply. I can't share the Organization ID. If you see any issue in my code you can share and that would be very helpfull for the whole community.

One thing I observed that If I comment sforce.one.navigateToSObject(accountid,"detail"); this statement code is working partially. Partially means it is giving erro but opening the nre record page behind it.

Please do let me know if anything else regarding this.

Regards,
Nilesh
AbhishekAbhishek (Salesforce Developers) 
Nilesh I am a direct salesforce employee.

And there are chances the issue is coming in another way too, but to confirm I need the Org ID.

I can understand you have many reasons to can't share the Org ID.

If I find anything else I will let you.