In VF Pages,in case of navigation to website outside salesforce.com domain or to a page with different controller or controller extension even without setredirect(true) it works so when exactly to use it?
Hi Ritu, The documentation is clear when it applies or not. Normally if it is the same controller then it applies but if it is a different controller or page then it redirects. Refer to the link (https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_System_PageReference_setRedirect.htm) "Note that if the URL of the PageReference object is set to a website outside of the salesforce.com domain, or to a page with a different controller or controller extension, the redirect always occurs, regardless of whether the redirect attribute is set to true or false."
Thanks Henry .So in case when i tried to use same controller then it worked automatically and no need to explicitly mention the setRedirect parameter and as per the statement in documentation even in case of different controller or controller extension it works so is it that when i want to naivgate to different URL I need to mention setRedirect parameter as true?
The documentation is clear when it applies or not. Normally if it is the same controller then it applies but if it is a different controller or page then it redirects. Refer to the link (https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_System_PageReference_setRedirect.htm)
"Note that if the URL of the PageReference object is set to a website outside of the salesforce.com domain, or to a page with a different controller or controller extension, the redirect always occurs, regardless of whether the redirect attribute is set to true or false."
Hope this helps
-Henry