Споделяне чрез


Create and manage product families, products, and bundles

 

Applies To: Dynamics CRM 2015

Define your product catalog by organizing your products in a hierarchical structure by creating products and bundles under a product family, defining related products, and adding properties (attributes) to the parent product family so that all the child products and bundles under a product family automatically inherit the properties.

By default, when you create a product family, product, or bundle record, they are in the Draft state. After you have created a product, defined related products, and configured attributes for the parent product family record, you must publish the product family, product, or bundle record for them to become available in the system to your sales agents for selling. More information: Publish a product family, product, or bundle

Note

For products not associated with a product family, that is, products that don’t have a parent product family record assigned to them, you can choose to create them directly in an Active state by setting the Organization.CreateProductsWithoutParentInActiveState attribute to 1 (true). By default, this attribute is set to 0 (false) for a fresh installation of Microsoft Dynamics CRM and to 1 (true) if you’re upgrading from a previous version of CRM to ensure compatibility for your applications working with the previous version of CRM where the product records were created in an Active state.

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

In This Topic

Define products, product families, and bundles

Bundles and kits

Define product relationships for enhanced suggestions during product sale

Define product properties (not supported through SDK)

Clone a product family, product, or bundle

Define products, product families, and bundles

Use the Product.ProductStructure attribute to define whether an item is a product family, product, or bundle. Set the value of this attribute to:

  • 1 to create a product

  • 2 to create a product family

  • 3 to create a bundle

Note

Bundles are new in CRM. For more information, see Bundles and kits later in this topic.

To create a kit type of product, continue to use the Product.IsKit attribute.

Here are some important points to consider while defining product families, products, and bundles:

  • A product family record can contain multiple child product family, product, and bundle instances in a hierarchical structure. For a child product family, child product, or child bundle instance, you define the parent product family instance using the Product.ParentProductId attribute. You can’t change the parent record once you’ve set it.

  • A product or bundle can’t be set as a parent, which implies that a product or bundle record can’t have child records.

  • A product family, product, or bundle instance can be part of only one product family instance.

  • There is no limit on the nesting level for a product family.

  • The Product.ValidFromDate and Product.ValidToDate attributes don’t have any out-of-box business logic associated with them, except that there is a check to ensure that the date in Product.ValidToDate should be later than or equal to the date in Product.ValidFromDate. If required, you can implement your own business logic based on these attributes. For example, you could run a scheduled job to automatically retire last season’s products by using the date value in the Product.ValidToDate attribute.

The following code sample demonstrates how you can create a product family and a child product record.

// Create a product family
Product newProductFamily = new Product
{
   Name = "Example Product Family",
   ProductNumber = "PF001",
   ProductStructure = new OptionSetValue(2)
};
_productFamilyId = _serviceProxy.Create(newProductFamily);
Console.WriteLine("\nCreated {0}", newProductFamily.Name);

// Create a product record under the product family
Product newProduct1 = new Product
{
   Name = "Example Product 1",
   ProductNumber = "P001",
   ProductStructure = new OptionSetValue(1),
   ParentProductId = new EntityReference(Product.EntityLogicalName, _productFamilyId),
   QuantityDecimal = 2,
   DefaultUoMScheduleId = new EntityReference(UoMSchedule.EntityLogicalName, _unitGroupId),
   DefaultUoMId = new EntityReference(UoM.EntityLogicalName, _unit.Id)
};
_product1Id = _serviceProxy.Create(newProduct1);
Console.WriteLine("Created {0} under the product family", newProduct1.Name);

Bundles and kits

A bundle is a feature introduced in CRM to replace the older kit functionality. Similar to a kit, a bundle is a collection of products that is sold as single unit. Product bundling is useful in grouping products in a way that customers get more benefit from the full line of products or to offer discounts on bundled products that enables you to group products and sell as a single unit.

Only products can be added to a bundle; you can’t add a product family, a bundle, or a kit record to a bundle. You can add products to a bundle or a kit by creating a product association record using the ProductAssociation entity. The ProductAssociation.ProductId record specifies the bundle or kit that you want to add a product to and the ProductAssociation.AssociatedProduct specifies the product to be added. The maximum number of products that can be added to a bundle is determined by the following organization setting: Organization.MaxProductsinBundle.

You can also use the Sales tab in the system settings area in Dynamics CRM or Dynamics CRM for Outlook to specify the maximum number of products that can be added to a bundle. More information:  TechNet: Manage product catalog configuration

The following code sample demonstrates how you can add products to a bundle.

// Add a product to a bundle
ProductAssociation newAssociation1 = new ProductAssociation
{
   AssociatedProduct = new EntityReference(Product.EntityLogicalName, _product1Id),
   ProductId = new EntityReference(Product.EntityLogicalName, _bundleId),
   Quantity = new decimal(15),
   ProductIsRequired = new OptionSetValue(0),
   UoMId = new EntityReference(UoM.EntityLogicalName, unit.Id)
};
_product1AssociationId = _serviceProxy.Create(newAssociation1);                    

// Add another product to the bundle                    
ProductAssociation newAssociation2 = new ProductAssociation
{
   AssociatedProduct = new EntityReference(Product.EntityLogicalName, _product2Id),
   ProductId = new EntityReference(Product.EntityLogicalName, _bundleId),
   Quantity = new decimal(20),
   ProductIsRequired = new OptionSetValue(1),
   UoMId = new EntityReference(UoM.EntityLogicalName, unit.Id),                        
};
_product2AssociationId = _serviceProxy.Create(newAssociation2);

if ((_product1AssociationId != null) && (_product1AssociationId != null))
Console.WriteLine("\nAdded both the products to the bundle");

For the complete sample, see Sample: Add products to a bundle.

Differences between kits and bundles

Both kits and bundles enable you to group products into a single unit, but here are some differences between the two.

Kits

Bundles

All the products in a kit are mandatory.

Some products in a bundle can be optional.

Kits support nesting; you can add a kit to another kit.

You can’t add a bundle to another bundle. You can only add products to a bundle.

While adding a kit to an opportunity, quote, order, or invoice, you can only see the kit level details; you can’t see individual products in the kit.

While adding a bundle to opportunity, quote, order, or invoice, you can see the bundle level details as well as individual products in the bundle.

Note

Kits are deprecated in the current release of Dynamics CRM; you should use bundles instead.

Define product relationships for enhanced suggestions during product sale

You can define related products for a product that are displayed as suggestions to your sales agents during opportunity or order management. The product suggestions for a product enables your sales agents to recommend related products and bundles/kits to the customers, and increase product sales. You can define the following relationships for a product: accessory, cross-sell, substitute, and up-sell. For example, Surface Pro can be added as an up-sell product for Surface RT so that when your sales agent is adding Surface RT to any opportunity, quote, order, or invoice, Surface Pro will be suggested as the up-sell option.

Use the ProductSubstitute.SalesRelationshipType attribute to define product relationships. Set the value of this attribute to:

  • 0 for up-sell

  • 1 for cross-sell

  • 2 for accessory

  • 3 for substitute

While defining product relationships, it’s important to define the direction of the relationship to prevent duplication of data. The supported directions the product relationships are:

Product relationship

Direction

Accessory

Uni-directional

Cross-sell

Uni-directional or Bi-directional

Substitute

Uni-directional or Bi-directional

Up-Sell

Uni-directional

Use the ProductSubstitute.Direction attribute to specify direction for a product relationship. Set the value of this attribute to:

  • 0 for uni-directional

  • 1 for bi-directional

The following code sample demonstrates how you can define relationships for products.

// Set product relationship
// Set product1 and product2 as substitute of each other (bi-directional)
ProductSubstitute newProductRelation = new ProductSubstitute
{
   SalesRelationshipType = new OptionSetValue(3),
   Direction = new OptionSetValue(1),
   ProductId = new EntityReference(Product.EntityLogicalName, _product1Id),
   SubstitutedProductId = new EntityReference(Product.EntityLogicalName, _product2Id)
};
_productRelationId = _serviceProxy.Create(newProductRelation);

Define product properties (not supported through SDK)

You can create and manage product properties (attributes) using Dynamics CRM or Dynamics CRM for Outlook only; this isn’t supported programmatically. This section just provides an overview of the product properties, which is critical to understanding the new product catalog feature. For information about creating and managing product properties, see Help & Training: Use properties to describe a product.

Product properties can only be associated to a product family instance, and not to a product or bundle record. All the child product family, product, and bundle instances under a parent product family inherit the properties associated to the parent product family. The child product family, product, and bundle records can override or overwrite the inherited properties using Dynamics CRM or Dynamics CRM for Outlook only.

The way you define a product property determines how it can be used by the sales agent at run time, that is, while adding an associated product to an opportunity, quote, order, or invoice.

  • An updatable product property’s value can be changed at run time, whereas the value of a read-only product property can’t be.

  • For a product property set as required, a value for the property must be specified at the run time. Otherwise, the property is displayed as unresolved.

  • A hidden property won’t be displayed to sales agents at the run time.

Note

Product properties don’t affect the pricing of a product. This implies that the Dynamics CRM pricing engine doesn’t support changing the price of a product based on a change in the product property values.

When you revise a product and change the properties, Dynamics CRM 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 already-created opportunities with the older version of 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. For more information about product state transitions, see Publish, revise, revert, retire, and activate products (product lifecycle).

The following new entities are introduced for storing product properties configuration; programmatic access and management of these entities isn’t supported:

  • DynamicProperty entity stores information about the product properties.

  • DynamicPropertyAssociation entity stores information about the product family that a product property is associated to.

  • DynamicPropertyOptionSet entity stores information about the option set values for a product property of option set data type.

Note

The maximum number of product properties that can be attached to a product family is determined by the following organization setting: Organization.MaximumDynamicPropertiesAllowed. The number comes into effect when you publish a child product record or bundle under a product family that the properties are attached to, and not at the time when you attach the properties to a draft product family record.

You can also use the Sales tab in the system settings area in Dynamics CRM or Dynamics CRM for Outlook to configure the maximum number of product properties. More information: TechNet: Manage product catalog configuration.

Clone a product family, product, or bundle

Use the CloneProductRequest message to clone a product family, product, or bundle record, and create a copy of the record under the same parent node. You must provide the ID of the record to clone. Cloning a product record also copies the properties of the product. The cloned record is created with the date and time stamp appended to the original values in the Product.Name and Product.ProductNumber attributes; the date time stamp denotes the time when the record was cloned. The following code sample demonstrates how to clone a product.

CloneProductRequest cloneReq = new CloneProductRequest
{
   Source = new EntityReference(Product.EntityLogicalName, _productId)
};

CloneProductResponse cloned = (CloneProductResponse)_serviceProxy.Execute(cloneReq);                                     
_productCloneId = cloned.ClonedProduct.Id;

// Retrieve the cloned product record
Product retrievedProduct = (Product)_serviceProxy.Retrieve(Product.EntityLogicalName, _productCloneId, new ColumnSet(true));
Console.WriteLine("\nCreated clone product: {0}", retrievedProduct.Name);

Next step

Publish your product records to make products available for selling by your sales agents. More information: Publish a product family, product, or bundle

See Also

Publish, revise, revert, retire, and activate products (product lifecycle)
Sample: Create and publish products
Sample: Clone product records
Sample: Add products to a bundle
Product catalog entities

© 2016 Microsoft. All rights reserved. Copyright