Field expression not allowed for generic SObject : You cannot use direct reference or assignment when working with sObjects. Instead you must use their get and put methods.
So instead ofsObject s = [SELECT Id, Name FROM Account LIMIT 1]; // This is allowed ID id = s.Id; // The following lines result in errors when you try to save String x = s.Name; System.debug(id+' a ***** b '+x);
sObject s = [SELECT Id, Name FROM Account LIMIT 1]; // This is allowed ID id = s.Id; // This is allowed String x = String.valueOf( s.get('Name') ); System.debug(id+' a ***** b '+x);
sObject s = [SELECT Id, Name FROM Account LIMIT 1]; // This is allowed ID id = s.Id; // The following lines result in errors when you try to save s.Name = 'Test'; System.debug(id+' a ***** b '+x);
sObject s = [SELECT Id, Name FROM Account LIMIT 1]; // This is allowed ID id = s.Id; // The following lines result in errors when you try to save s.put('Name', 'Test'); System.debug(id+' a ***** b '+x);
comment in last block is misguiding... for a moment i tot there is no solution for insterting
ReplyDelete