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
Christine MarshallChristine Marshall 

System.QueryException: List has more than 1 row for assignment to SObject Trailhead Error

I am doing the Assign Accounts, Rules, and Users to Territories module on Trailhead and keep getting the following error:

Challenge Not yet complete... here's what's wrong: 
There was an unexpected error in your org which is preventing this assessment check from completing: System.QueryException: List has more than 1 row for assignment to SObject

I don't know what this bit means: System.QueryException: List has more than 1 row for assignment to SObject
Gustavo BertolinoGustavo Bertolino
This error message occurs when you try to pass a list of sObject records into a single object. So probably in your code you're passing several things and trying to put all of them in a single sObject, which causes the exception. Solve it by taking the records (probably you're using a query to get them) and pass them in a list of sObjects instead.

This might be helpful.

Besides, take a look at the following posts:

https://developer.salesforce.com/forums?id=906F0000000AkbpIAC

https://developer.salesforce.com/forums?id=906F00000008zwEIAQ
Christine MarshallChristine Marshall
I'm not writing any code. I've created a Territory Assignment rule in my practice org and am trying to pass a Trailhead module but keep getting this error.
Christine MarshallChristine Marshall
Issue resolved. It was the assignment rule using less than instead of less or equal to.