cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Regular Visitor

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
Highlighted

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

Highlighted
Regular Visitor

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
Highlighted

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

Highlighted
Regular Visitor

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.

Highlighted

Re: How to access the underlying entity in Standard control

That is part of the context.

 

context.parameters.YourParameterName.attribute.LogicalName

 

 

Highlighted
Regular Visitor

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
Check this Out

Helpful information

Featuring samples like Return to the Workplace and Emergency Response Applications

August 2020 Community Challenge: Can You Solve These?

August 2020 Community Challenge: Can You Solve These?

We're excited to announce our first cross-community 'Can You Solve These?' challenge!

secondImage

Return to Workplace

Reopen responsibly, monitor intelligently, and protect continuously with solutions for a safer work environment.

secondImage

Super Users Coming in August

We are excited for the next Super User season.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Users online (7,659)