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
NalinakuNalinaku 

Srcup not defined on javascript button opening Visualforce page

Hi, 
I have a on click javascript button on the case pagelayout which opens a visual force page and was working fine but suddenly user started getting error Url does not exists. but when I login as user and click on that button I see "srcUp is not defined" error. 

Here is the simple javascript on that button. 

srcUp('apex/CaseVFPage_v1?id={!Case.Id}');, 
AbhishekAbhishek (Salesforce Developers) 
Here is an example of the JS in button to open a VF page in console.

{!REQUIRESCRIPT("/support/console/30.0/integration.js")} 
if(typeof(srcUp) == 'function') //Checks that it is in console

var openSubtab = function(result){ 
sforce.console.openSubtab(result.id,'/apex/YourVFPageName?caseID={!Case.Id}&inConsole=true', true, 'Subtab Name', null); 
}; 
sforce.console.getEnclosingPrimaryTabId(openSubtab); 


else{ 
window.parent.location.href=('/apex/YourVFPageName?caseID={!Case.Id}&inConsole=false') 
}

SrcUp can be used to open subtabs in the service cloud console.

This Button code will handle the opening of the VF page in console and outside console very effectively.


I hope you find the above information is helpful. If it does, please mark as Best Answer to help others too.

Thanks.
 
NalinakuNalinaku
Hi Abhishek, 
Thanks for your inputs on using this button on console. I will use this approach going forward. 

This button has been working from years and suddenly one of our user started facing  the error when he clicked on this button in chrom browser,  and I suggested to try in some other browser which worked. He tried in firefox and also tried in chrom incognito both worked.  No other user reported this, so my conclusion was that some issue in user chrome browser or he installed some extension which is creating this conflict.