You need to sign in to do that
Don't have an account?

Parameters not getting passes properly in URL
I have written a method in controller class to pass two ids in the URL to the next vf page ... but it is not going properly in the URL..
public pagereference upload()
{
Id so ;
Id oppId = ApexPages.CurrentPage().getParameters().get('OpId');
for(SOWrap sw :wrapper)
{
so = sw.SOID;
}
return new pagereference('/apex/DocumentUploader?Id=' +so+ '&OppId =' + oppId);
}
The URL it is passing is :
https://cs16.salesforce.com/apex/DocumentUploader?+OppId+=006f0000003aqzUAAQ&Id=a39f00000004IKtAAM
I am not able to use OppId in the new page, page not loading .. any help here
return new pagereference('/apex/DocumentUploader?Id=' +so+ '&OppId=' + oppId);
All Answers
Hi,
I can see the problem is in the URL you have pasted i.e. "https://cs16.salesforce.com/apex/DocumentUploader?+OppId+=006f0000003aqzUAAQ&Id=a39f00000004IKtAAM". It has additional '+' before and after 'OppId'. The correct URL should be https://cs16.salesforce.com/apex/DocumentUploader?OppId=006f0000003aqzUAAQ&Id=a39f00000004IKtAAM.
However, I did a dry run to replicate the same on my dev org and working absolutely fine. Could you please elaborate bit more on what you are trying to do.
Happy to help you!
Regards,
Digamber Prasad
I am trying to pass two parameters to a new VF page , so I used the following line in the method in the controller :
public pagereference upload()
{
Id so ;
Id oppId = ApexPages.CurrentPage().getParameters().get('OpId');
for(SOWrap sw :wrapper)
{
so = sw.SOID;
}
return new pagereference('/apex/DocumentUploader?Id=' +so+ '&OppId =' + oppId);
}
This page URL has a parameter OpId - Opportunity ID - which I want to pass on to the next page .. but when I am clicking on the button which calls this method... it is giving this defect URL :
https://cs16.salesforce.com/apex/DocumentUploader?+OppId+=006f0000003aqzUAAQ&Id=a39f00000004IKtAAM
return new PageReference('https://cs16.salesforce.com/apex/DocumentUploader?OppId=006f0000003aqzUAAQ&Id=a39f00000004IKtAAM');
This is working ...but when I refresh it or again load this page , it is not working.
How can i get the URL corrected?
Seems like a glitch in salesforce:-(
I just tried and got the same, but when i tried after removing all the spaces inside the strings it is working perfectly. Try removing all the unnecessary spaces in the string and let me know if the issue is still there.
Thanks,
George
Visit my blog here
The url is the this :
https://cs16.salesforce.com/apex/DocumentUploader?Id=a39f00000004IKtAAM&OppId+=006f0000003aqzUAAQ
It has an opportunity Id.. but I cannot use this because when I query with this id , its giving
System.QueryException: List has no rows for assignment to SObject
Class.AttachmentUploaderController.ReturnTo: line 38, column 1
The return to method on this page :
public PageReference ReturnTo()
{
Id oppId = ApexPages.CurrentPage().getParameters().get('OppId');
opp = (Opportunity)[select Id, Name from Opportunity where Id =: oppId];
pageReference pg4 = new pageReference('/apex/DSFinalPage?OpId=' +opp.Id);
pg4.setRedirect(true);
return pg4;
}
It should be exactly like this:
https://cs16.salesforce.com/apex/DocumentUploader?Id=a39f00000004IKtAAM&OppId=006f0000003aqzUAAQ
i am using this line of code to recirect :
return new pagereference('/apex/DocumentUploader?Id=' +so+ '&OppId =' + oppId);
the url which is passing is :
https://cs16.salesforce.com/apex/DocumentUploader?Id=a39f00000004ILRAA2&OppId+=006f0000003aqzUAAQ
here I want to use OppId to querry but cannot access because when I query with OppId , it giving error :
System.QueryException: List has no rows for assignment to SObject
Whats the correction i can make here?
return new pagereference('/apex/DocumentUploader?Id=' +so+ '&OppId=' + oppId);
I am not getting how this extra + sign is appended with the OppId in the URL, because the line of code says :
return new pagereference('/apex/DocumentUploader?Id=' +so+ '&OppId =' + oppId);
This works.. thanks for the help