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
sfdcfoxsfdcfox 

Redirecting back to "default" namespace from managed package.

I thought this would be obvious, but I can't seem to get this to work, so looking for a bit of help here.

 

Basically, I have a custom setting with a text field; the intent is to redirect to a page if this setting is set, so users can hook into some of our functionality by providing custom pages.

 

In my controller, I check to see if this text field has a value, and if so, I redirect to it.

 

public ApexPages.PageReference redirect() {
    ApexPages.PageReference ref = null;
    if(settings.general.override_page__c != null) {
        ref = new apexpages.pagereference(url.getsalesforcebaseurl().toexternalform()+'/apex/'+settings.general.override_page__c);
        ref.setRedirect(true);
        ref.getParameters().putAll(new map<string,string> { 'id' => String.valueOf(record.id), 'entity' => Entity.getName(record) } );
    }
    return ref;
}

However, this is apparently still redirecting to our package's namespace, instead of back to the standard namespace. 

 

Any suggestions?

 

 

bob_buzzardbob_buzzard

I've had a few issues around this area - nothing that I recall that exactly matches though.  Things tend to work okay until I package and installed into the target org, but then I've found that I need to use the Page.<name> syntax in order to get the correct namespace, which doesn't really help in your case as the managed package would need to know about the pages available in the target org, which it can't.

 

The only other option that I seem to recall having some success with, although I can't find an example so my memory may be playing tricks, is to handle the redirect concept in the page - e.g. set a flag or similar and use javascript to change the 'window.location.href' to the fully qualified URL.