4

I am facing issues in passing the values to custom fields which are same as shown below.

00Ni000000CPDRf

00Ni000000CPDRF

I am passing them as shown below:

PageRef.getParameters().put(System.Label.abc,xyz.abc__c);

But when the page is loaded its displaying only one parameter. It's overriding the other Id.

How can I resolve this issue.

  • I'm afraid I don't really understand your question from what you have provided. Are you trying to pass the 18 character ID across in the URL with getParameters().put() - and it's not doing so? Or are you having problems storing 15 character IDs in (String?) fields in an object, or ..? – Simon Lawrence Feb 11 '14 at 9:54
  • I am passing the 2 field IDs in URL to a standard page using PageRef.getParameters().put() method. The issue here is that the map is not case sensitive. It is displaying only one out of the 2 IDs in the URL. Hope this helps. – Keepcalmncode Feb 11 '14 at 14:40
  • You definitely have two different identifiers for your URL parameters (System.Label.abc) ? Do they appear in the URL bar as different IDs? String Map keys are case sensitive (see the bottom of this page salesforce.com/us/developer/docs/apexcode/Content/…) Maybe it would be useful to see the code that is consuming the URL parameters and putting them in the map? – Simon Lawrence Feb 11 '14 at 14:55
  • Only one id is getting added to the URL parameters.I fixed it by creating a URL with these parameters in the controller.Thanks for looking into it.I will try to figure out why its not working with the PageRef.getParameters().put() method. – Keepcalmncode Feb 11 '14 at 15:35
1

The solution here if you must use an id in your querysting is to use the 18-digit case-insensitive Salesforce Id rather than the 15-digit case sensitive version. Here is a utility method for getting an 18-digit Id in apex:

String.valueOf((Id)(15digitId));
  • i tested it by passing 18 digit ids of both of them but it didnt work..I added it in the URL directly – Keepcalmncode Feb 10 '14 at 18:36
  • Further information on 15/18 character ID fields can be found in this blog post: srlawr.blogspot.co.uk/2012/09/… If that is of any use? – Simon Lawrence Feb 11 '14 at 9:55
  • I am passing the 2 field IDs in URL to a standard page using PageRef.getParameters().put(); – Keepcalmncode Feb 11 '14 at 14:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.