Friday, July 5, 2013

Setting Id Fields on sObjects for Updates


Starting with Apex code saved using Salesforce.com API version 27.0, the Id field is now writeable

         list<Account> lstA = [select id,name from account limit 1];
Account a1 = new Account();
        a1.id = lstA[0].id;
a1.name = 'update through ID';
update a1;

but attempting to insert these sObject instances results in an error.

No comments:

Post a Comment