Hello,
first time posting, sorry it's with a problem/question!
I've created a Portal linked to CRM D365.
I've got a page with an Entity List, which displays fine.
Selecting a record from the Entity List opens the Entity Form on its own page. Yay.
That last step works fine, but only when the Entity List view only contains 1 record.
As soon as the List contains 2 or more records, I get an error when trying to open a record.
The error says "sequence contains more than one element" and a load of other stuff that I don't fully understand.
Through research I have found that the important part of the error message is this:
System.Linq.Enumerable.SingleOrDefault(IEnumerable`1 source) +470
...and it seems I need to find a way to change "SingleOrDefault" to "FirstOrDefault", however I do not know where or how to do that.
Has anyone experienced this and found a solution? I'd be immensely grateful to hear your suggestions.
The full error message:
Server Error in '/' Application.
Sequence contains more than one element
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.InvalidOperationException: Sequence contains more than one element
Source Error:
| An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. |
Stack Trace:
[InvalidOperationException: Sequence contains more than one element]
System.Linq.Enumerable.SingleOrDefault(IEnumerable`1 source) +470
Adxstudio.Xrm.Web.UI.WebControls.EntityForm.GetEntitySourceDefinition(OrganizationServiceContext context, Entity entityform) in S:\Framework\Adxstudio.Xrm\Web\UI\WebControls\EntityForm.cs:1201
Adxstudio.Xrm.Web.UI.WebControls.EntityForm.CreateChildControls() in S:\Framework\Adxstudio.Xrm\Web\UI\WebControls\EntityForm.cs:578
System.Web.UI.Control.EnsureChildControls() +107
System.Web.UI.Control.PreRenderRecursiveInternal() +58
System.Web.UI.Control.PreRenderRecursiveInternal() +227
System.Web.UI.Control.PreRenderRecursiveInternal() +227
System.Web.UI.Control.PreRenderRecursiveInternal() +227
System.Web.UI.Control.PreRenderRecursiveInternal() +227
System.Web.UI.Control.PreRenderRecursiveInternal() +227
System.Web.UI.Control.PreRenderRecursiveInternal() +227
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3671 |
Any help would be much appreciated. Thank you!!
Pete.
(ps. cross-post https://community.dynamics.com/365/f/dynamics-365-general-forum/424351/d365-crm-portal-error-on-loading-entity-form-server-error)