You need to sign in to do that
Don't have an account?
bhagavanmca04@yahoo.com
I need simple Update method code for Custom Object.
Hi am new SFDC. i have Furniture__C custom object with Name,Type__C fields. So I need to insert,delete n update through code upto 100 records. i have exception in Update method. FATAL_ERROR|System.QueryException: List has more than 1 row for assignment to SObject. Furniture__c fr = [Select Name From Furniture__c Where Name = 'Das']; fr.Name = 'ram'; Update fr; any modifications or possibility to Update records. I need Update method code.
Furniture__c fr = [Select Name From Furniture__c Where Name = 'Das' Limit 1];
Give this way
Hi,
Give LIMIT to your query if query is returning more than one row.
Try this code:
Try below code for editing record:
Hope this helps:)
Thanks,
Devendra
Hi
Yes Use limit on ur query so that it will not take more than 1.
You can do this way to update all records of Name='Das' to Name='ram' :
List<Furniture__c> objC = [Select Name From Furniture__c Where Name = 'Das'];
for(Furniture__cobjEach : objC)
{
objEach.Name = 'ram';
}
update objC;