You need to sign in to do that
Don't have an account?
Molson94
VF: Building URLs with Parameters / Extra Characters being added
Hi all,
Simple question I hope.
I have a custom controller that after creating a new custom object, redirects to the second page in the series.
This is the code i am using for moving to the next page:
The end result i am trying to achieve is the next pages url is appended with the following: ?v=VENDORID?cc=CCID
So i can then pull those parameters and do some other validation etc..
What the application is doing however is returning the following:
?cc=a07e0000001qHsNAAU&v=a09e0000002k5ueAAA
The italicized portions are the correct ID fields that i am looking to identify, but the bolded portions are causing errors when the second page grabs the parameters.
Can anyone help explain why this is the case and/or advise on how to acheive the desired result?
or
If it is simpler, what would be the correct syntax to build out these URLs via string?
Thank you all for your help!
Simple question I hope.
I have a custom controller that after creating a new custom object, redirects to the second page in the series.
This is the code i am using for moving to the next page:
public PageReference step2() { //when submitted, check the title id against the title records tidL = [SELECT id FROM Title__c WHERE Title_ID__c = :tID LIMIT 1]; if (!tidL.isEmpty()){ cc.Vendor__c = vendor.get(0).id; cc.Title__c = tidL.get(0).id; cc.Status__c = 'Open'; upsert(cc); PageReference redirect = Page.cc2; redirect.getParameters().put('v',vendor.get(0).id); redirect.getParameters().put('cc',cc.id); redirect.setRedirect(true); return redirect; }
The end result i am trying to achieve is the next pages url is appended with the following: ?v=VENDORID?cc=CCID
So i can then pull those parameters and do some other validation etc..
What the application is doing however is returning the following:
?cc=a07e0000001qHsNAAU&v=a09e0000002k5ueAAA
The italicized portions are the correct ID fields that i am looking to identify, but the bolded portions are causing errors when the second page grabs the parameters.
Can anyone help explain why this is the case and/or advise on how to acheive the desired result?
or
If it is simpler, what would be the correct syntax to build out these URLs via string?
Thank you all for your help!
I think you are comparing your Id which you get from parameter with a Hard coded value in code which is not a good approach.
You can discard the last three digit easily by using String substring method in Salesforce.
Please mark my answer as a best solution to your question to help others if it solves your problem.
All Answers
I think you are comparing your Id which you get from parameter with a Hard coded value in code which is not a good approach.
You can discard the last three digit easily by using String substring method in Salesforce.
Please mark my answer as a best solution to your question to help others if it solves your problem.
Thank you for the response and explanation.
i was not aware of the 18 digit ID and how that was rendered.
I think ill be able to find a solution.