This content is archived. See latest version here

Last updated: Oct 21 2014

This document describes how to work with customer groups. Contacts can be managed within customer groups, to which you can apply specific pricing and discounts by group, as well as personalization. A customer (user) or an organization can be assigned to a customer group and this drives two areas in the system; the selling prices price can be set for eligibility for a customer group and also for eligibility for discount campaigns. There is a priority to these; if there is a customer group assigned to an organization then this is used to drive pricing and campaign eligibility.

Customer groups can be created in the Commerce Manager administration interface, and then applied to contacts and organizations when creating and editing these. These customer groups are common to both contacts and organizations, and can then be applied to customer segments being targeted for marketing campaigns and customer group specific pricing included for variants.

Classes referred to here are available in the following namespace:

How it works

Customer Group is available as a field for both customer and organization records. The CustomerContact class exposes this field as CustomerGroup and the Organization class exposes it as OrgCustomerGroup, with get and set public accessors available for both. These fields use a descriptive string value representation of the Customer Group to which a customer or organization belong. Internally the field stores the strings as integers that map to the string values so the acceptable values are limited by that mapping, but the acceptable values can be expanded at runtime. This capability is provided through the Business Foundation library. The acceptable values are shared between the two fields as the "ContactGroup" MetaEnum type. See the documentation on the MetaEnum class for working with the Business Foundation dynamic enum implementation.

As a Business Foundation field, CustomerGroup does not exist in the database in the initial installation and is added when AutoInstallMetaDataModule is run during initial site load. The default values available in the field are included in code in the enum CustomerGroup.eContactGroup, although the enum is of limited use otherwise. The eContactGroup enum is fixed at compile time and will not change at runtime when the list is edited in the application or in code by external processes.

The accessor properties on the Organization and CustomerContact are the preferred means of accessing these data, but if it is necessary to access the values directly it can be done via EntityObjectHelper.GetStringEntityEnumProperyValue(). The field name for the CustomerContact version of the Business Foundation field is stored as a constant in ContactEntity.FieldCustomerGroup, and the equivalent field name for the Organization Business Foundation field is stored as a constant in OrganizationEntity.FieldOrgCustomerGroup.

The CustomerContact class has an additional get-only property named EffectiveCustomerGroup that combines these data. If the CustomerContact is associated with an Organization and that Organization has a CustomerGroup assigned, then EffectiveCustomerGroup returns that CustomerGroup. If no Organization is assigned to the CustomerContact or if the assigned Organization does not have a CustomerGroup assigned, then EffectiveCustomerGroup returns the CustomerGroup recorded on the CustomerContact record itself, if any. This evaluation is not recursive on the Organization hierarchy, so only the Organization to which the CustomerContact belongs directly is considered and any parent Organizations of that Organization are ignored.

Upgrade note: EffectiveCustomerGroup has replaced the existing CustomerGroup field in places where it is appropriate. Pricing and promotions now evaluate customer group membership based on EffectiveCustomerGroup.

Using customer groups on promotions

Customer groups are not applied directly to a single promotion. They are controlled at the Campaign level by means of Customer Segments, which can take membership in a Contact group as a condition. It is possible to edit these in code but it is not a common need and is not recommended.

Using customer groups on pricing

Refer to the Customer specific pricing section of the Pricing documentation.


Do you have feedback on this documentation? Send an email to documentation@episerver.com. For development-related questions and discussions, refer to our Forums on https://world.episerver.com/forum/