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
Jennifer.SchnellJennifer.Schnell 

Custom JavaScript Link Not Working after My Domain and Instance Refresh

We recently switched over to My Domain and also had an instance refresh over the weekend.  I have one link on our home page that is not working, below is the code.  I see it is referring to "ServerInstance", where do I go to update this?  Thanks

window.open(getServerInstance() + "/apex/EditExpenseReportForward?retURL=%2Fa24%2Fo&save_new=1&sfdc.override=1");

function getServerInstance()
{
var url = window.location + "";
var urlParseArray = url.split(".");
var i;
var sInstance;
for(i=0; i< urlParseArray.length; i++) {
if (urlParseArray[i].indexOf("salesforce") != -1) {
sInstance = urlParseArray[i-1];
}
else if (urlParseArray[i].indexOf("force") != -1) {
sInstance = urlParseArray[i-2];
}
}
urlParseArray = sInstance.split("//");
sInstance = urlParseArray[0] + "//pse." + urlParseArray[1] + ".visual.force.com";
return sInstance;
}
Banwari kevat1Banwari kevat1
Hi Jen,
 Try it withoud getServerInstance() method. it will  automatically populate with current salesforce instance.
use following: 
window.open("/apex/EditExpenseReportForward?retURL=%2Fa24%2Fo&save_new=1&sfdc.override=1");

Let me know if issue is persisting after that.

Thanks
Banwari
Jennifer.SchnellJennifer.Schnell
Thanks Banwarl.  I replace the line as you specified and I receive this error now:

Visualforce Error
Page EditExpenseReportForward does not exist 
Create Page EditExpenseReportForward
 
Banwari kevat1Banwari kevat1
Hi Jen,
This error occurs when page is not availble in org. Now check the spelling of page name or page exists in org.
Thanks
Banwari
Jennifer.SchnellJennifer.Schnell
We also switched to My Domain, I am sure that is why the page doesn't exist.  How do I check the apex code associated with that javascript link?