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 Apps / Access Page Context wi...
Power Apps
Unanswered

Access Page Context within a component

(3) ShareShare
ReportReport
Posted on by 8

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.

 

 

I have the same question (0)
  • Hemant Gaur Profile Picture
    Microsoft Employee on at

    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. 

  • davallen Profile Picture
    Microsoft Employee on at

    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.

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    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

  • vigneshR Profile Picture
    15 on at

     

    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.

     

    Capture_EntityrReference.PNG

     

    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

     

  • Min Rao Profile Picture
    187 on at
  • ScottDurow Profile Picture
    1,039 on at

    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?

  • Hemant Gaur Profile Picture
    Microsoft Employee on at

    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 

  • MJain Profile Picture
    2,450 on at

    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 . 

     

    Thanks 

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    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

  • ScottDurow Profile Picture
    1,039 on at

    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.

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 Apps

#1
11manish Profile Picture

11manish 534

#2
WarrenBelz Profile Picture

WarrenBelz 416 Most Valuable Professional

#3
Valantis Profile Picture

Valantis 306

Last 30 days Overall leaderboard