Is there any way to Programmatically register PCF control on entity?
FYI, i am able to add this control on sub grid of form by modifying form xml programatically.
Thanks in advance..
Given that you specify the type of control a field in the form editor I suspect the only way programmatically add the control to the form would be to changing the XML of the form programmatically - how to do that is probably worthy of some research and a blog post of 3 for someone with the time and inclination to do so as doing it incorrectly will result in an invalid page.
You can configure the control to the relevant field and then look at the change in the custom control configurations to the form XML. This configuration binds the field to the custom control and right form factor. Directly modifying the formXML will work but bypass any validations like control missing from CDS.
I want to add PCF control at entity level as shown in above screenshot.
By modifying form xml we can add PCF control on field or on Sub grid.
Is there any way, we can modify entity xml programmatically.
That wasn't what you asked for in the original question you talked about forms.
In this case can I ask what your actual use case is?
Programmatically changing things as @HemantG points out bypasses all the security checks built into the front end of D365 / Powerapps which is fine when the worst thing you can do is break part of a form, but when replacing the entity's default control will cause a lot of problems if the control does not exist, is invalid / broken or were you to try and move the entity to another solution.
That's not to say you cannot try and do it I just really can't see any advantage and a lot of disadvantages in what you want to do. You would be better off creating a solution that contains both the PCF control and the top level entity details of the entities you want the control on and moving the solution around in sync.
Check out the News & Announcements to learn more.
Did you know that you can visit the Power Query Forum in Power BI and now Power Apps
Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.
DynamicsCon is a FREE, 4 half-day virtual learning experience for 11,000+ Microsoft Business Application users and professionals.