0

I have below statement throwing String Exception.

selRepId = ApexPages.currentPage().getParameters().get('RepId');

Here selRepId is a Public getter setter set ID field. Is the issue like string to ID conversion throwing error?

If so, please let me know a way out, I am unable to resolve it.

5

Don't type cast or use ID class. Do it like as:

String selRepId {get;set;}
selRepId = ApexPages.currentPage().getParameters().get('RepId');


// will work. If it is a correct Id
CustomObject.Rep__c = selRepId;
| improve this answer | |

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.