cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Mikko_K
Level: Powered On

How to access the underlying entity in Standard control

I'm building a PCF standard control and I want to access the underlying entity. I dont want to use input parameters for that in this specific case because that doesn't automatically save the entity at the time of change.

 

I could do this by calling context.webAPI.updateRecord() (I guess?) but I need entity type and ID of course. How I get this information in standard component as the .dataSet.records is not available? It would feel a bit stupid to have to give this information as input properties which the user of the component would have to set correctly in the form editor.

2 ACCEPTED SOLUTIONS

Accepted Solutions
DanzMaverick
Level: Powered On

Re: How to access the underlying entity in Standard control

If you are looking to access EntityId and EntityTypeName then this was already answered in the following post: https://powerusers.microsoft.com/t5/PowerApps-Component-Framework/Access-Page-Context-within-a-compo...

 

context.mode.contextInfo.entityId
context.mode.contextInfo.entityTypeName

As these are currently unsupported you will need to use

@ts-ignore

View solution in original post

Mikko_K
Level: Powered On

Re: How to access the underlying entity in Standard control

Thanks again, perfect. So many hidden things. You have a missing "s" from "attribute". As a summary for anyone else looking for these things:

Entity ID:

context.mode.contextInfo.entityId (add typing to componentframework.d.ts)

Entity logical name: 

context.parameters.YourParameterName.attributes.EntityLogicalName

Field logical name:

context.parameters.YourParameterName.attributes.LogicalName

 

View solution in original post

4 REPLIES 4
DanzMaverick
Level: Powered On

Re: How to access the underlying entity in Standard control

If you are looking to access EntityId and EntityTypeName then this was already answered in the following post: https://powerusers.microsoft.com/t5/PowerApps-Component-Framework/Access-Page-Context-within-a-compo...

 

context.mode.contextInfo.entityId
context.mode.contextInfo.entityTypeName

As these are currently unsupported you will need to use

@ts-ignore

View solution in original post

Mikko_K
Level: Powered On

Re: How to access the underlying entity in Standard control

Thanks for the super fast response!

 

One thing I noticed I would also need is the name of the field where the component is attached to. Meaning the name of field mapped to the main (first) input property. This is likely impossible to find out so for that one I need a manual input property. If someone has a way though, it would be nice to know.

DanzMaverick
Level: Powered On

Re: How to access the underlying entity in Standard control

That is part of the context.

 

context.parameters.YourParameterName.attribute.LogicalName

 

 

Mikko_K
Level: Powered On

Re: How to access the underlying entity in Standard control

Thanks again, perfect. So many hidden things. You have a missing "s" from "attribute". As a summary for anyone else looking for these things:

Entity ID:

context.mode.contextInfo.entityId (add typing to componentframework.d.ts)

Entity logical name: 

context.parameters.YourParameterName.attributes.EntityLogicalName

Field logical name:

context.parameters.YourParameterName.attributes.LogicalName

 

View solution in original post

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors
Users Online
Currently online: 328 members 6,039 guests
Please welcome our newest community members: