You need to sign in to do that
Don't have an account?
Praz01
Invalid constructor syntax, name=value pairs can only be used for SObjects
I am using the following code for past 1 year but suddenly today this error cropped up which was not there earlier
Account[] accts = new Account[]{}; accts.add(new Account(name = 'ApexTestPOSController1', Local_Id__c = 'SimId2009083001')); accts.add(new Account(name = 'ApexTestPOSController2', Local_Id__c = 'SimId2009083002')); accts.add(new Account(name = 'ApexTestPOSController3', Local_Id__c = 'SimId2009083003')); insert accts;
How to get rid of it?
This error is quite erratic too..sometimes coming and sometime going
try changing it to
List<Account> accts = new List<Account>();
I have tried your code, it works fine except local_id. It may be due to account object local_id field .
Actually now it's not giving any problem ...I think this is quite erratic..
Hi Guys,
I am new to salesforce.
When i am trying to insert data into an object ,I am receiving the error "Invalid constructor syntax, name=value pairs can only be used for SObjects".
Apex
---------
public with sharing class Account {
public Integer total { get; set; }
public integer Number2 {get; set; }
public integer Number1 { get; set; }
public pagereference Add()
{
/*Number2=Number2;
Number1 =Number1;*/
total=Number1 + Number2;
Account a=new Account(Number1=Number1,Number2=Number2,total=total);
insert a;
// Database.SaveResult[] results = Database.insert(a);
return null;
}
}
Thanks in advance,
Patel.