web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Suggested Answer

Portal - Scope/Permission Error

(0) ShareShare
ReportReport
Posted on by 5

I have the Account entity. It has a 1:N relationship with Contact and 1:N with Leads. (OOTB relationships)

Each Lead has a 1:N relationship with a custom entity named Claims.

My goal is to allow an external customer, a contact of the account, to use the portal and create claims on an existing lead for their account.

I have set up the portal and used the following entity permissions:

Permission 1: "My Accounts" - Contact Scope for Account entity

Permission 2: "My Account's Leads" - Account Scope for Lead entity

Permission 3: "My Account's Claims" - Account Scope for Claims entity.

On the portal, this successfully filters lists and lookups to those of the contact's accounts. Great.

Problem: There is an Account lookup on the Insert form for a Claim. When I set the account, I receive the following Yellow Screen of Death:

Sequence contains no elements

[InvalidOperationException: Sequence contains no elements]
   System.Linq.Enumerable.First(IEnumerable`1 source) +405
   Adxstudio.Xrm.Services.<GetDependencies>d__29.MoveNext() in G:\Agents\BA1256\_wap\83\s\Framework\Adxstudio.Xrm\Services\CacheDependencyCalculator.cs:331
   System.Linq.<ConcatIterator>d__59`1.MoveNext() +637
   System.Linq.<DistinctIterator>d__64`1.MoveNext() +79
   System.Collections.Generic.List`1..ctor(IEnumerable`1 collection) +504
   System.Linq.Enumerable.ToList(IEnumerable`1 source) +70
   Adxstudio.Xrm.Services.OrganizationServiceCache.GetCachePolicy(Object query, Object result, Boolean invalidateDepedencies) in G:\Agents\BA1256\_wap\83\s\Framework\Adxstudio.Xrm\Services\OrganizationServiceCache.cs:0

When the account is left blank, this does not happen (successful submission). If the Contact is given Global scope for the Account entity, this does not happen. (debugging only)

This also does not happen for the lookup to select your existing lead, whether blank or filled out. That saves correctly.

I am developer, I know this is a Linq error. I have looked at the old, non-SaaS source code on Github, but these lines have been changed from that version.

I have tried various combinations of Parent-Child permissions. No luck.

I have cleared the portal cache, no luck.

There is no front-end customization, javascript, entity metadata, etc.

Any advice would be helpful.

I have the same question (0)
  • Suggested answer
    Alexander369 Profile Picture
    5 on at

    "No man can serve two masters: for either he will hate the one, and love the other" - Book of Matthew 6:24

    This was the root of the problem. First, I changed my permission structure to the following:

    1. "My Accounts" - Contact Scope for Account Entity

    2. "My Account's Leads" - Account Scope for Lead Entity

    3. "My Account's Lead's Claims" - Parent Scope (under "My Account's Leads") for Claims entity.

    This caused the YSOD to go away and be replaced by a "normal" error - one with a correlation ID. I enabled diagnostics and pulled the error from an Azure Blob: the AccountID had a value of Guid.Empty.

    After trying to determine why Global Scope Account permissions didn't cause this error but Contact Scope did, I had to submit. Having two referential relationships was the issue...and one that I ultimately couldn't resolve.

    I removed the Account lookup from the form and will now use Entity Metadata to set it on Save. This has at least allowed me to proceed; thankfully, the requirements are fluid enough that this should pass muster.

    This is the sandbox, but when this is moved to production, I think the best solution is to avoid creating two referential relationships in the first place. This error did not occur using CRM forms.

  • Suggested answer
    Alexander369 Profile Picture
    5 on at

    double post

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
Tom_Gioielli Profile Picture

Tom_Gioielli 108 Super User 2025 Season 2

#2
Jimmy Passeti Profile Picture

Jimmy Passeti 50 Most Valuable Professional

#3
Gerardo Rentería García Profile Picture

Gerardo Rentería Ga... 49 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans