function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
SrinuSrinu 

List has more than 1 row for assignment to SObject

Hi,

   

   I am getting this one Error while executing my opportunity Wizard: List has more than 1 row for assignment to SObject

 

I have enabled my debugs and try to find out in which line error happened. But nothing can findout 4m my debug log. It doen't display any error details.

 

Reasons might be:  Any SOQL is getting 2 or more records insted of single record.

                                     

we can eliminate this situation by putting 'Limit 1' to SOQL....Right?

 

NOTE: This error is not happening at all times, Error coming only in Some times...


Any guess for this error and any suggestions how to solve this error?

 

Any help would be greatly appreciated....!!!


-Srinu

TejTej

that might work, or get the records into a list and use the first record in the list, list[0].

JBabuJBabu

Hi,

 

Reason for the error is that you are trying to store two records in one object variable.

If you need two values from the SOQL store them in a list object variable instead of object variable.

Using limit 1 or using list obejct variable depends on your requirement (either of then will solve your problem)

 

Thanks,

JBabu.

SrinuSrinu

Hi,

 

 Thanks Tej, Babu for ur reply,

 

  Do you have any idea about this problem which i have posted in our blog jus now:

 http://boards.developerforce.com/t5/Apex-Code-Development/List-has-more-than-1-row-for-assignment-to-SObject/td-p/457231

 

 

-Srinu

JBabuJBabu

Hi,

 

Debug logs after 2MB are not showed that could be the reason why you are not able to see the error message in the body of the page. (it would be on the top to show the error message).

If you know the proable error areas from the error message then you can use "system.assert" and try to figure out the values and change the code acordingly.

 

Thanks,

JBabu.