Announcements
Is it possible to access the page context (at least the entity type and guid of the entity) within a field component. I can understand why you may not wish to make it generally available but it would be useful to offer the option to pass it as a parameter option.
We are evaluating this ask, it would help if you can share some more details on the target scenario ?
As a workaround you can evlaute using input configurable properties.
Can you share where i would find this example or information? I am also trying to pass the id of the entity that my PCF is embedded on the form. This would be helpful if I want to show a custom visual that requires executing a FetchXml to query the aggregated data.
I would like to see this too.
I have a control bound to a subgrid/dataset. I want to be able to create a new record in that dataset, but in order to do so I need to either:
1. Have the id of the parent entity so that I can use the webapi.
or
2. Have a way to add a record to the dataset passed to the control.
It doesn't appear that I can do either?
Thanks
Jason
Hi @dmonks, @Anonymous, @davallen,
If I am not wrong you could use below format to get the entity Id and EntityType of the form on which the custom control is added.
you can refer below post for example code
https://powerusers.microsoft.com/t5/PowerApps-component-framework/i-want-to-get-relevent-data-about-powerapps-component-framework/m-p/352299/highlight/true#M805
Please Feel free to mark the answer as verified if it is useful
Regards,
Vignesh.R
Now, the api is documented.
https://docs.microsoft.com/en-us/powerapps/developer/component-framework/reference/entityreference
There are actually two ways of getting the entityId and type name:
mode (https://docs.microsoft.com/en-us/powerapps/developer/component-framework/reference/mode)
context.mode.contextInfo.entityId context.mode.contextInfo.entityTypeName context.mode.contextInfo.entityRecordName
Or Page (not documented at all)
context.page.entityId context.page.entityTypeName
Neither of these are documented. @HemantG Are either of these supported?
This is in the back log and will be added in near future. To unblock you can use in the interim (not officially supported though)
context.mode.contextInfo.entityId context.mode.contextInfo.entityTypeName
The final sematics will be communicated but are expected to be inline with above and hence control update should be straightforward.
hemant
Have you tried declaring entityReference at the class level :
private _entity: ComponentFramework.EntityReference;
and later on in function this._entity.name, this._entity.id.guid to get the current record data .
Hello Scott,
I've tried to use context.mode.contextInfo.entityTypeName but I faced the following error message:
Property 'contextInfo' does not exist on Type 'Mode'
any workaround to get the EntityId and/or EntityName ?
Thx
That is odd - it always has worked for me.
The other way I've seen it done is:
context.page.entityId
but apparently this isn't going to be the supported way.
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.
Congratulations to our 2026 Super Users!
Congratulations to our 2025 community superstars!
These are the community rock stars!
Stay up to date on forum activity by subscribing.
11manish 534
WarrenBelz 416 Most Valuable Professional
Valantis 306