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
jd_06jd_06 

PageReference Instantiation changes URL content

Hi All - I am troubleshooting an issue with a visualforce redirect to a Conga Merge URL.  I have a custom save button on my page.  When user clicks the button I call a method in the controller that performs several actions.  At the end of the method I return the pagereference.  

What I'm finding is that after I instantiate the PageReference with a URL the resulting reference is different.

Here is my example:  Again this is just for troubleshooting purposes.  This is not my actual URL, my main question is why the url is getting modified.

PageReference ref = new PageReference('https://www.appextremes.com/apps/Conga/PM.aspx?SessionId=00DR0000001tYhK%21AQ0AQMPOzH5tBpCxtW_UfXfHoGV5PK4G2FPYVeXbgJQMyNXA04ukVuMy7WkF4ZfA6D8Are43sfTxIwaD9uxBReE0N4rUJrpy&ServerUrl=https%3A%2F%2Fcs2.salesforce.com%2Fservices%2FSoap%2Fu%2F8.0%2F00DR0000001tYhK&Id=0065000000M0zpq&TemplateId=a0M50000000QzTl&ReportId=00O50000002keBY?pv0=T33367&ReportId=00O50000002keBd?pv0=T33367&ReportId=00O50000002keBi?pv0=T33367&ReportId=00O50000002keBn?pv0=T33367&lg0=0&lg1=ALI%20Project%20Discount%20Form%20Generated&OFN=Discount+form+Calabrese+Res+5%2F27%2F2014&lg4=1&ds7=2&EmailRelatedToId=0065000000M0zpq&CETID=a1D50000000C7d4&EmailToID=+&lg3=1&MFTSId0=a0aR0000004tY1s&MFTS0=SpecialDiscountCode__c&MFTSValue0=Created&FP0=1');

If I include a system debug right here for the value of ref it is the following

https://www.appextremes.com/apps/Conga/PM.aspx?CETID=a1D50000000C7d4&ds7=2&EmailRelatedToId=0065000000M0zpq&EmailToID=+&FP0=1&Id=0065000000M0zpq&lg0=0&lg1=ALI+Project+Discount+Form+Generated&lg3=1&lg4=1&MFTS0=SpecialDiscountCode__c&MFTSId0=a0aR0000004tY1s&MFTSValue0=Created&OFN=Discount+form+Calabrese+Res+5%2F27%2F2014&ReportId=00O50000002keBY%3Fpv0%3DT33367&ServerUrl=https%3A%2F%2Fcs2.salesforce.com%2Fservices%2FSoap%2Fu%2F8.0%2F00DR0000001tYhK&SessionId=00DR0000001tYhK%21AQ0AQMPOzH5tBpCxtW_UfXfHoGV5PK4G2FPYVeXbgJQMyNXA04ukVuMy7WkF4ZfA6D8Are43sfTxIwaD9uxBReE0N4rUJrpy&TemplateId=a0M50000000QzTl

Notice the difference between what I put into the Reference and what is coming out of it.

Can someone please explain why my URL is getting changed?

Thank you very much.
Jason
kevin Carotherskevin Carothers
Your "pre" URL has four instances of ReportId -- the "after" URL has one -- the last instance of that param.   


jd_06jd_06
Thanks Kevin for comment.  Yes, that is what is puzzling to me.  The 'pre' is what I'm trying to assign the pagereference to but the 'after' is what is actually getting assigned to the pagereference.  Do you think this has to do with some URL encoding?  Because if you notice in the 'pre' the ?pv0=T33367 gets converted to %3Fpv0%3DT33367 in the 'after'

thanks again!
Jason