Skip to main content

Posts

Showing posts from August, 2014

Invalid constructor syntax, name=value pairs can only be used for SObjects (Line: 90)

If you bumped to this entry, I would like to thank you.I 'll update the content as below.Since my explanation not really helpful at previous post.You still able to view old post at OBSOLETE section below at the end of this post. I always accidentally face this exception : Invalid constructor syntax, name=value pairs can only be used for SObjects because I instantiate inner class like SObject such as below : WrapperObj obj = new WrapperObj ( paramId = a . Id , isChecked = a . Primary__c , Account = a ); While that only valid for SOBJECT.For inner class, we should use this.Without name value pair. WrapperObj obj = new WrapperObj ( a . Id , a . Primary__c , a ); public class MyExtension { //other code public void retrieveInfo (){ List < WrapperObj > listAccountObject = new List < WrapperObj > (); List < Account > listAccount = [ Select Id , Primary__c from Account where Id =: acct . Id ];