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.

1 Answer 1

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;

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .