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.
2. Have a way to add a record to the dataset passed to the control.
It doesn't appear that I can do either?
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
Please Feel free to mark the answer as verified if it is useful
There are actually two ways of getting the entityId and type name:
context.mode.contextInfo.entityId context.mode.contextInfo.entityTypeName context.mode.contextInfo.entityRecordName
Or Page (not documented at all)
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)
The final sematics will be communicated but are expected to be inline with above and hence control update should be straightforward.
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 .
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 ?
Check out new user group experience and if you are a leader please create your group
Check out how to claim yours today!
Test your skills now with the Cloud Skill Challenge.