편집

다음을 통해 공유


Publish, revise, revert, retire, and activate products (product lifecycle)

By default, a product record is in the Draft state when you create it, and isn’t available for your sales agents. The record becomes available to your sales agents only when you publish it, which changes the state of the record to Active. For products that aren’t associated with a product family, that is, products that don’t have a parent product family record, you can create them directly in an Active state by setting the Organization.CreateProductsWithoutParentInActiveState column to 1 (true). By default, this column is set to 0 (false) for a fresh installation of Dynamics 365 Sales and to 1 (true) if you’re upgrading from a previous version of Dynamics 365 Sales to ensure compatibility for your applications working with the previous version of Dynamics 365 where the product records were created in an Active state.

You can also use the Sales tab in the system settings area in Dynamics 365 Sales or Microsoft Dynamics 365 for Outlook to specify whether products are created in an active state. More information: Manage product catalog configuration

Furthermore, you can revise, revert, retire, and activate your product records to maintain your product catalog as per your business requirements. The following illustration shows the state transitions of a product when you perform various operations on a product record in Dynamics 365 Sales.

Screenshot of product lifecycle and state transitions.

Activate\* : The activate operation is applicable for certain type of product records only. More information: Activate a product or kit record

Publish a product family, product, or bundle

Use the SetStateRequest message to publish an individual product family, product, or bundle record. In this case, the state of the target record changes from Draft to Active. A child product or bundle record under a product family record can be published only if the parent product family record is published (in the Active state). You cannot publish multiple product family, product, or bundle records at once.

Use the PublishProductHierarchyRequest message to publish a product family hierarchy including the child products and bundles. You can use this message only with a product family record. The state of the target product family record and all the child product or bundle records changes from Draft to Active.

The following code sample demonstrates how you can publish an individual product family, product, or bundle record.

SetStateRequest publishRequest = new SetStateRequest  
{  
   EntityMoniker = new EntityReference(Product.EntityLogicalName, _productId),  
   State = new OptionSetValue((int)ProductState.Active),  
   Status = new OptionSetValue(1)  
};              
_serviceProxy.Execute(publishRequest);  

The following code sample demonstrates how you can publish a product family, including its child records.

PublishProductHierarchyRequest publishRequest = new PublishProductHierarchyRequest  
{  
   Target = new EntityReference(Product.EntityLogicalName, _productFamilyId)  
};  
_serviceProxy.Execute(publishRequest);  
  

For the complete sample code, see Sample: Create and publish products.

Important

For the product or bundle records that aren’t associated with a product family, you must publish them individually after creating or editing them to make them available to your sales agents. For product or bundle records associated with a product family, use the PublishProductHierarchyRequest message on the parent product family record to publish multiple child product or bundle records, along with the parent product family record, at once.

Also, for products that aren’t associated with a product family, you can create them directly in an Active state by setting the Organization.CreateProductsWithoutParentInActiveState column to 1 (true). Alternately, use the Sales tab in the system settings area in Dynamics 365 Sales or Microsoft Dynamics 365 for Outlook to specify whether products not associated with product families are created in an active state. More information: Configure product catalog information

Revise a product family, product, or bundle

Use the SetStateRequest message to revise a product family, product, or bundle record.

  • When invoked for a product family record, it revises the product family and its child records.

  • When invoked for a product or a bundle record, it revises the individual record only.

    The state of the target record changes from Active to Under Revision.

    After the product properties (columns) are updated, the target record must to be published for the changes to reflect. On publishing, the state of the target record changes from Under Revision to Active.

Note

When you revise a product and change the properties, Dynamics 365 Sales internally creates a new version of the product and copies the product details from the existing product to the newer version. The new product version has all the details including price lists, product relationships, and properties. The opportunities created with the older version of the product can continue to refer to the older version of the product. The opportunities that are created after the product is revised or retired will refer to the current (newer) product version.

Revert a product family, product, or bundle

Use the RevertProductRequest message to revert a product family, product, or bundle record to its last Active state. All the product property (column) changes done to the record since it was last published (Active state) will be lost.

  • When invoked for a product family record, it reverts the product family and its child records to their last Active state, and all the changes done to the product properties of the records since they were last published will be lost.

  • When invoked for a product or a bundle record, it reverts the individual product or bundle record to its last Active state, and all the changes done to the product properties of the record since it was last published will be lost.

    The state of the target record changes from Under Revision to Active.

    The following code sample demonstrates how to revert a product record.

RevertProductRequest revertReq = new RevertProductRequest  
{  
   Target = new EntityReference(Product.EntityLogicalName, _productId)  
};  
RevertProductResponse reverted = (RevertProductResponse)_serviceProxy.Execute(revertReq);  

Retire a product family, product, or bundle

Use the SetStateRequest message to retire a product family, product, or bundle record.

  • When invoked for a product family record, it retires the entire product family hierarchy.

  • When invoked for a product or a bundle record, it retires the individual record only.

    The state of the target record changes to Retired.

Note

You can’t retire a product that is part of a published (Active) bundle. Also, you can’t add a retired product to a bundle or can’t add a product to a retired bundle.

Activate a product or kit record

Use the SetStateRequest message to activate only the following types of record:

  • A retired product record that does not have a parent record.

  • A retired kit record.

    The state of the target record changes from Retired to Active.

Note

You can’t activate a retired product family or a retired bundle record.

Manage Product Pricing
Create and manage product families, products and bundles
Product catalog tables