If you have followed the previous parts of this series, you would be able to build any PCF component of Field type with ease. In this final part, we will be looking at how to build a solution for our component and deploy it on Dynamics 365 CRM instance. So let’s begin
1> Go to the directory of the PCF component. Open Command Prompt and navigate to that directory.
navigate to PCF from cmdline
2> Create a new folder called DeploymentSolution and navigate inside it by this command: “mkdir DeploymentSolution && cd DeploymentSolution”.
3> Create a new solution project inside the DeploymentSolution folder by this command: “pac solution init --publisher-name crmpublisher --publisher-prefix wod”
*Note: The publisher's name and prefix should be unique to the CRM instance.
4> Now let's add our project reference to this solution project by – “pac solution add-reference --path c:\GetTranslationPCF”.
5> Finally, we will use MSBuild to trigger build for our project. For that open Developer Command Prompt from Start menu, navigate to our Project folder and run this command: “msbuild /t:restore”
6> Run “msbuild” command again to get the solution zip file. The result would show Build Succeeded.
7> Now check the bin directory for the zip file and port it into your CRM instance. Bin directory is generally placed in DeploymentSolution\bin\Debug.
8> After importing the zip in CRM, open the Case entity Main Form in the form editor and edit the Description field by double-clicking on it.
Description field properties
9> Click on Add Control and select your PCF component and click on Add. The name of the component will be display-name-key which is there in your ControlManifest.Input.xml.
10> Finally select the required fields against the Properties. Also select - Web, Phone and Tablet to enable and display PCF control on all device types.
Map CRM field to properties of PCF
11> Click on Ok. Save and Publish the form. Check on any case, the value of the description as value Case Status changes.
Check PCF on form
Now that we have seen our component working properly, we can explore more possibilities like calling external APIs or showing Maps or even responsive custom web components.
The possibilities are endless but we have to keep in mind that performance of the form and device(in case of offline mode) should never be compromised in scenarios where we intend on having a LOT of PCF components on a single form.
I hope that this series helped you in getting up and running with PCF components.
For more in-depth information, feel free to check out Microsoft’s official documentation.