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
sfdc@isha.ax1814sfdc@isha.ax1814 

A Problem with the onclick javascript for this button or link was encounterd:

Hi iam getting below error in production  when ever i click on the button on a related list on the case object that  to only one particular case.But in my developer sandbox  it is working fine .what may be the problem.Can anybody help on this.

 User-added image


And below is the code behind that button.

{!REQUIRESCRIPT("/support/console/26.0/integration.js")}
srcUp('/apex/PPS_CaseHolderPage?id={!Case.Id}&btname=New_Service_Order');



Regards,
Isha




Best Answer chosen by sfdc@isha.ax1814
CheyneCheyne
You might find this article (https://success.salesforce.com/ideaView?id=08730000000YKxYAAW" target="_blank) on the srcUp function helpful. It looks like that function only works in the service console. Are you in the regular salesforce application when you try to use it in production? You can work around this by checking if srcUp is defined and, if not, using a standard javascript function:

if (typeof(srcUp) == 'function') {
    srcUp('/apex/PPS_CaseHolderPage?id={!Case.Id}&btname=New_Service_Order');
} else {   
    window.open('/apex/PPS_CaseHolderPage?id={!Case.Id}&btname=New_Service_Order');

All Answers

CheyneCheyne
You might find this article (https://success.salesforce.com/ideaView?id=08730000000YKxYAAW" target="_blank) on the srcUp function helpful. It looks like that function only works in the service console. Are you in the regular salesforce application when you try to use it in production? You can work around this by checking if srcUp is defined and, if not, using a standard javascript function:

if (typeof(srcUp) == 'function') {
    srcUp('/apex/PPS_CaseHolderPage?id={!Case.Id}&btname=New_Service_Order');
} else {   
    window.open('/apex/PPS_CaseHolderPage?id={!Case.Id}&btname=New_Service_Order');
This was selected as the best answer
sfdc@isha.ax1814sfdc@isha.ax1814
Hi Cheyne thank you so much it is working fine as u said i tried on by using console app it is working fine.


Regards,
Isha
Minh Pham 3Minh Pham 3

@Cheyne: my problem is the same but the diff is "srcSelf is not defined", here is my code below that button: 

{!requireScript("/soap/ajax/37.0/connection.js")}
 
if({!CONTAINS( User.Role_Name__c ,  Case.Case_owner_rolename__c )})
{
if( !{!CONTAINS( Case.Case_owner_rolename__c , "CR")} && {!ISNULL( Case.Relate_Dept_PIC__c )} )
{
alert ("Please input Relate Dept PIC");
}
else
{
srcSelf('/apex/Confirm_Assign_Case_v2?isdtp=vw&caseid={! Case.Id }');
}
}
else
{
alert ("Only user in {!Case.Case_owner_rolename__c} queue can change this Case .");
}
 

How can i fix it correctly? 

Thank you much :D