Edit

Share via


Install items from the catalog in Power Platform using code

Catalog items are stored in the Catalog Item (mspcat_applications) table. This table has a mspcat_TPSID (Catalog Item Id) column that stores a unique string value you can use to refer to a catalog item.

Install a specific version

When using PAC CLI pac catalog install command or the mspcat_InstallCatalogItemByCID message, pass a string catalog item ID (cid or CID) parameter.

When you want to install a specific version of a catalog item, append the version number to the string value passed to the catalog item ID parameter. The version value comes from the related Package (mspcat_packages) record Version (mspcat_version) value.

For example, let's say that the following table represents the available versions of the MyCatalogItem catalog item:

Version Description
3.0.0.0 Published
2.0.0.0 Active but not published
1.0.0.0 inactive

The following catalog item ID parameter values have different behaviors:

Example Result
MyCatalogItem Installs version 3.0.0.0 (Published version)
MyCatalogItem@3.0.0.0 Installs version 3.0.0.0 (Published version)
MyCatalogItem@2.0.0.0 Installs version 2.0.0.0
MyCatalogItem@1.0.0.0 Fails with an error indicating that the version isn't available.

Use the pac catalog install command to install items from the catalog.

In this example, you're connected to the EnvironmentWithCatalog.

Use the -cid parameter to specify the catalog item ID and -te to specify the environment to install the catalog item in. You can also specify a specific version.

pac catalog install  `
   -cid ContosoConferencesCustomConnector `
   -te https://<org to install item>.crm.dynamics.com/
Connected as user@domain
Connected to... EnvironmentWithCatalog
Tracking ID for this installation is 9cc47262-2f33-ef11-8409-6045bdd3aec3

The Tracking ID returned is the primary key of the Install History (mspcat_InstallHistory) record which you can review to see whether the installation succeeds.

What is Microsoft Power Platform CLI?

Check status of catalog installation

The following table shows the statuscode Choices/Options options of the Install History (mspcat_InstallHistory) table. Completed (526430003) represents a successful submission, Failed (526430003) represents an unsuccessful submission. Custom state model transitions ensure that the status value moves through the active status reasons until the installation becomes inactive.

State Value Label Allowed Transition to
0 (Active) 1 Requested 2,526430001,526430002,526430003,526430004
1 (Inactive) 2 Inactive
0 (Active) 526430001 Pending 2, 526430002,526430003,526430004,
0 (Active) 526430002 In Progress 2,526430003,526430004,
1 (Inactive) 526430003 Completed
1 (Inactive) 526430004 Failed

Use the pac catalog status command to check the status of catalog installations.

pac catalog status --tracking-id 0e6b119d-80f3-ed11-8849-000d3a0a2d9d --type Install
Connected to... TestCatalog
Connected as user@domain
Status of the Install request: Requested

What is Microsoft Power Platform CLI?