A couple of months back I had written my first PCF Control to display GUID of the record, it was more of a hello world kind of thing.
Well, the code was using Xrm.Page client API which as we know is deprecated.
So, it was time to update it to use context instead.
More on context
Connect to the organization, select Edit existing PCF Control option
Specify the Control Location and VS Command Prompt Location (VsDevCmd.bat)
And click on Reload Details which will list down the details of the component and the solution as shown above.
Click on Open in VS Code to open the project in Visual Studio Code and start making the required update.
It opens the project in Visual Studio Code.
Here let us update the index.ts file to use context to fetch the GUID.
Save the changes. And click on Build
Now click on Test to see it in action or to debug.
We can see it populating the GUID
To debug it à we can use the developer tools (F12) and put the breakpoint in the index.ts file.
Now let us deploy it to our organization
Deployment in action
After successful deployment, we can see the solution added to our organization
Now let us use it for the single line of the text control.
Publish the changes.
Create the new lead record and we can see the GUID of the record created in the control
Thus, the wonderful PCF Custom Control Builder plugin of XrmToolBox makes it so easy to update the existing PCF Control and also to create new PCF Control.
Hope it helps..