Deploying PCF Control to D365 Environment

This is a follow up blog on creation of PCF controls to use in our D365 environment. If you have not seen that and you want to know more about creation of PCF controls, you can refer the blog Step by Step process to create PCF Controls. In this blog, we will talk about connecting to our D365 environment and deploying the code using Power Apps CLI commands. This is not required in normal scenario as most of us will be using D365 for CE web portal to import our solution which we created as part of our previous blog. Still if anyone interested or anyone wants to get this automated, we can use these commands.

As a first step to deploy our components to the CRM instance, we have to create an authentication profile or use an existing profile to connect to the CRM instance. For that we can use the below command. You will be prompted for your credentials. Provide the credentials you want the system to connect.

pac auth create --url <Instance Url>

We can list down any existing profiles using the first command below. It will provide the list with the active profile with a * next to the index. Use the second command to switch between the profiles. Third command below will get the basic information about the environment like Org Id, Unique Name, Friendly Name, Org Url, User Id.

pac auth list
pac auth select --index <index of the profile>
pac org who

If for some reason we need to delete a particular authentication profile, use the first command below. If we have to clear all the authentication profiles in a single shot then use the second command.

pac auth delete --index <index of the profile>
pac auth clear

Once the authentication profile is created successfully we can start pushing our code components. We can use the push capability to do the following. Make sure the prefix you mention in this command matches the publisher prefix of our solution in which the components will be included.

pac pcf push --publisher-prefix <prefix of your publisher>

In case by any chance you want to use an existing solution to push these components, then we can use another command as follows. Settings value mentioned below are autonumbering, calendar, customization, emailtracking, externalapplications, general, isvconfig, marketing, outlooksynchronization, relationshiproles, sales.

pac solution clone --name(-n) <name of the solution> --targetversion(-v) <version of our solution> --include (-i) <settings that should be included>

This approach really helps us to speed up the process as it bypasses the code component versioning requirements and does not require that we build our solution to import the code component. We can use either of the approaches as per our convenience and which fits our project life cycle. Hope this blog was useful for you. Thank you for your time reading this blog.


One thought on “Deploying PCF Control to D365 Environment

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s