You need to sign in to do that
Don't have an account?
returning a PageReference from Controller and Salesforce appends ?inline=1 to the URL
Hello All,
I have a custom page and controller. I am trying to do some error handling within the controller as such:
public PageReference sendMail2PM(){
string PMID = [select Deliverable_Owner__c from P4_Contract_Deliverable__c where id = :this.cd.id].Deliverable_Owner__c;
string PMEmail = [select email from contact where id=:PMID].email;
if(PMEmail==null){
PageReference errorPage = new PageReference('https://cs1.salesforce.com/apex/errorLanding');
errorPage.setRedirect(true);
return errorPage;
}
}
My problem is that when the redirect happens, somehow "inline=1" gets appended to the URL. It seems that when the inline parameter is present then the page renders without headers or sidebars. I want the header and sidebar so users know they are still in saleforce.
Where is the "inline=1" coming from and how do I get rid of it? Or else how do I make the redirect happen with headers and sidebars?
I don't know the specifics to the "inline=1" parameter, but if you want to enforce the standard salesforce.com header and sidebar, make sure your apex page is defined as follows:
<apex:page showHeader="true" sideBar="true" .../> ... </apex:page>
Also, I notice you hardcode the URL "cs1.salesforce.com...". That will only work when in a Sandbox environment. You should use relative URL such as:
PageReference errorPage = new PageReference('/apex/errorLanding');
Why do you have to do a redirect?
Couldn't you just
...
if(PMEmail==null){
PageReference errorPage = Page.errorLanding;
return errorPage;
}
Granted, the URL in the browser taskbar is not updated ... but if you can live with that.
('https://cs1.salesforce.com/apex/errorLanding'); instead of this use it
('../apex/errorLanding');you will get current page.
Hello Frodo,
Have you get any solution for this issue? If yes, could you please let me the solution.
You might try the following:
PageReference pageRef = new PageReference('/'+this.selectedAccount); pageRef.setRedirect(true); pageRef.getParameters().put('inline','0'); return pageRef;
You'll end up with something like this...
https://na6.salesforce.com/0018000000M32zIAAR?inline=0&inline=1
... which will negate the inline=1 for you.
- R
I realize this is an old post....but has anyone found a solution to removing the inline=1 parameter?
Thanks.
putting
only results in a douplicat param in the url so it looks like:
theurl?pram=something&inline=0&inline=1
I did find that if you switch the button/link to an outputlink it wont put that in url and will redirect to the page fine. You may just need to add action support to the link depending on what you are trying to do.
I have this working on many pages in many different ways so i know its posssible, but you just need to not use a commandlink/button
for example this button is in the case view:
and the controller:
since this is a controller extention for case the 'cse' is refrincing that... but its not inportant for what you are tying to do. Just wanted to show an example of it working.
it works. you help me a lot.
Thanks a lot..........
I got it.........
I tried the following and it is working as expected
But this mark up in the Component
<a href="javascript:void(0);" onclick="{!c.gotoURL}" >Link Title</a>
and this function inside the jsController
gotoURL : function(component, event, helper) {
var ctarget = event.currentTarget;
var id_str = ctarget.dataset.value;
console.log(id_str);
var urlEvent = $A.get("e.force:navigateToURL");
urlEvent.setParams({ "url":"/apex/VisualForcePageName")});
urlEvent.fire();
}