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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Pages / Parent Account Contact...
Power Pages
Unanswered

Parent Account Contact needs to create records for Child Account in Custom Table

(0) ShareShare
ReportReport
Posted on by 177

Hi,

I have a custom table X that contains transactions about specific properties (Accounts). Our original solution assumed that property level contacts would be entering the transactions, so we configured the portal to save the portal contact and their property (Account) on our custom table. All worked fine until we received a request to allow contacts of the Management Company to read, create, and update records for the properties under their account. 

 

In the example below Jo, who works for Management Company A, should be able to create custom table x transactions (not pictured) and associate them one of the properties under her company, Property 1, Property 2, or Property 3.

Management Companies (Account) to Properties (Account) to Contacts RelationshipsManagement Companies (Account) to Properties (Account) to Contacts Relationships

 

 

I have been able to successfully create table permissions allowing Jo to view the transactions associated with each of the 3 properties. When she opens the create form, the Property is on the form for selection, however, she sees the properties under her Management Company A and the Management Company Account in the lookup. She should not see the account associated with her in the lookup. Additionally, if she selects any of those options and tries to save the record, she gets the below error. Also, inspecting the field shows that the value for the selected account is 00000000-0000-0000-0000-000000000000. 

Server Error in '/' Application.


Sequence contains no elements

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 no elements

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 no elements]
 System.Linq.Enumerable.First(IEnumerable`1 source) +455
 Adxstudio.Xrm.Services.<GetDependencies>d__29.MoveNext() in S:\Framework\Adxstudio.Xrm\Services\CacheDependencyCalculator.cs:335
 System.Linq.<ConcatIterator>d__59`1.MoveNext() +638
 System.Collections.Generic.List`1..ctor(IEnumerable`1 collection) +526
 System.Linq.Enumerable.ToList(IEnumerable`1 source) +69
 Adxstudio.Xrm.Services.OrganizationServiceCache.GetCachePolicy(Object query, Object result, Boolean invalidateDepedencies, Boolean applyVirtualEntityTTL) in S:\Framework\Adxstudio.Xrm\Services\OrganizationServiceCache.cs:0
 Adxstudio.Xrm.Services.OrganizationServiceCache.Insert(String key, Object query, Object result, Boolean invalidateDepedencies, Boolean applyVirtualEntityFilter) in S:\Framework\Adxstudio.Xrm\Services\OrganizationServiceCache.cs:661
 Adxstudio.Xrm.Services.<>c__DisplayClass58_0`3.<GetCachedResult>b__1(ObjectCache cache, TResult result) in S:\Framework\Adxstudio.Xrm\Services\OrganizationServiceCache.cs:598
 Microsoft.Xrm.Client.Caching.<>c__DisplayClass5_0`1.<Get>b__1(String key) in S:\Framework\Microsoft.Xrm.Client\Caching\ObjectCacheProvider.cs:119
 Microsoft.Xrm.Client.Threading.<>c__DisplayClass6_0`1.<Get>b__0() in S:\Framework\Microsoft.Xrm.Client\Threading\LockProvider.cs:55
 Adxstudio.Xrm.Threading.MonitorLockProvider.Lock(String key, Int32 millisecondsTimeout, Action action) in S:\Framework\Adxstudio.Xrm\Threading\MonitorLockProvider.cs:23
 Microsoft.Xrm.Client.Threading.LockProvider.Get(String key, Int32 millisecondsTimeout, Func`2 loadFromCache, Func`2 loadFromService) in S:\Framework\Microsoft.Xrm.Client\Threading\LockProvider.cs:60
 Adxstudio.Xrm.Services.OrganizationServiceCache.GetCachedResult(TRequest query, Func`2 execute, Func`2 selector, String cacheKey, Boolean isAuditableQuery, Int32& cacheMissedMetricValue, Boolean applyVirtualEntityFilter) in S:\Framework\Adxstudio.Xrm\Services\OrganizationServiceCache.cs:0
 Adxstudio.Xrm.Services.OrganizationServiceCache.LookupAndInsert(TRequest query, Func`2 execute, Func`2 selector, String selectorCacheKey, Boolean allowStaleData, Boolean isAuditableQuery) in S:\Framework\Adxstudio.Xrm\Services\OrganizationServiceCache.cs:383
 Adxstudio.Xrm.Services.OrganizationServiceCache.InnerExecute(TRequest request, Func`2 execute, Func`2 selector, String selectorCacheKey) in S:\Framework\Adxstudio.Xrm\Services\OrganizationServiceCache.cs:323
 Adxstudio.Xrm.Services.ContentMapOrganizationServiceCache.Execute(OrganizationRequest request, Func`2 execute, Func`2 selector, String selectorCacheKey) in S:\Framework\Adxstudio.Xrm\Services\ContentMapOrganizationServiceCache.cs:36
 Adxstudio.Xrm.Services.PortalBusOrganizationServiceCache.Execute(OrganizationRequest request, Func`2 execute, Func`2 selector, String selectorCacheKey) in S:\Framework\Adxstudio.Xrm\Services\PortalBusOrganizationServiceCache.cs:44
 Adxstudio.Xrm.Services.CachedOrganizationService.Execute(OrganizationRequest request, Func`2 selector, String selectorCacheKey) in S:\Framework\Adxstudio.Xrm\Services\CachedOrganizationService.cs:367
 Adxstudio.Xrm.Services.CachedOrganizationService.Execute(OrganizationRequest request) in S:\Framework\Adxstudio.Xrm\Services\CachedOrganizationService.cs:358
 Adxstudio.Xrm.Services.<>c__DisplayClass26_0.<Execute>b__0() in S:\Framework\Adxstudio.Xrm\Services\CrmOnlineOrganizationService.cs:245
 Microsoft.Practices.TransientFaultHandling.RetryPolicy.ExecuteAction(Func`1 func) +466
 Microsoft.Xrm.Sdk.Client.OrganizationServiceContext.Execute(OrganizationRequest request) +227
 Adxstudio.Xrm.Security.CrmEntityPermissionProvider.TryAssert(OrganizationServiceContext serviceContext, CrmEntityPermissionRight right, EntityReference entityReference, EntityMetadata entityMetadata, Boolean readGranted, EntityReference regarding) in S:\Framework\Adxstudio.Xrm\Security\CrmEntityPermissionProvider.cs:1096
 Adxstudio.Xrm.Web.UI.WebControls.CrmEntityFormView.AssertEntityPermissions(Operation operation, Dictionary`2 values, EntityReference entityReference) in S:\Framework\Adxstudio.Xrm\Web\UI\WebControls\CrmEntityFormView.cs:1756
 Adxstudio.Xrm.Web.UI.WebControls.CrmEntityFormView.HandleInsert(CommandEventArgs args) in S:\Framework\Adxstudio.Xrm\Web\UI\WebControls\CrmEntityFormView.cs:1870
 Adxstudio.Xrm.Web.UI.WebControls.EntityForm.OnBubbleEvent(Object source, EventArgs args) in S:\Framework\Adxstudio.Xrm\Web\UI\WebControls\EntityForm.cs:489
 System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +50
 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5445

 


Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.8.4494.0

 

Clearly, I'm doing something wrong, but I cannot figure out where that is. Please not we removed the configuration to automatically save the Property based on the portal user so that should not be the problem.

 

I have also reviewed these two links and found that they are related to viewing the records and did not appear to relate to creating or updating records:

https://powerusers.microsoft.com/t5/Power-Apps-Portals/Portal-Entity-Permissions-Show-only-Parent-company-data/m-p/828436

https://powerusers.microsoft.com/t5/Power-Apps-Portals/What-is-the-best-way-to-show-list-of-records-related-to-two/m-p/704612

 

Any help is most appreciated.

 

Thanks!

Piper

Categories:
I have the same question (0)

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Pages

#1
rezarizvii Profile Picture

rezarizvii 53

#2
DP_Prabh Profile Picture

DP_Prabh 49

#3
oliver.rodrigues Profile Picture

oliver.rodrigues 28 Most Valuable Professional

Last 30 days Overall leaderboard