London Dev Meetup Rescheduled! Due to unavoidable reasons, the event has been moved to 21st May. Speakers remain the same—any changes will be communicated. Seats are limited—register here to secure your spot!
London Dev Meetup Rescheduled! Due to unavoidable reasons, the event has been moved to 21st May. Speakers remain the same—any changes will be communicated. Seats are limited—register here to secure your spot!
This document provides an introduction to the Customer Management system, a central part where you can add individual organizations, contacts, and Commerce Manager users. From Customer Management you can also create purchase orders for each individual customer account.
Definitions:
Classes referred to here are available in the following namespaces:
The image below provides an overview of the design of Customer Management and the relationship between the various objects. You can create different types of relationships between Business Foundation Objects, refer to the Meta Class References under Business Foundation, section for more information.
Customer groups provide a way to target multiple Customers and Organizations for pricing and promotions. Both the Customer and the Organization expose their own CustomerGroup information, and the Customer has derived property called the EffectiveCustomerGroup which combines the two with the priority on the Organization value. Please see the specific documentation on Customer Groups for additional information.
In pricing and promotions, EffectiveCustomerGroup is used instead of the regular CustomerGroup. The EffectiveCustomerGroup returns the CustomerGroup of the parent Organization, if the CustomerContact belongs to a parent Organization that belongs to a CustomerGroup, or its own otherwise.
To access the child organizations of an organization, you must use EntityObject, a core Business Foundation object. The EntityObject is an important base class for CustomerContact, Organization, and any custom business objects you create. EntityObject has only a property named PrimaryKeyId that you can use to retrieve the full organization object from the CustomerContext singleton.
Example: retrieving organization object
List<Organization> PartnerOrganizations = new List<Organization>();
foreach (object child in PartnerOrganization.GetChildren())
{
EntityObject obj = child as EntityObject;
Organization org = CustomerContext.Current.GetOrganizationById(obj.PrimaryKeyId.Value);
if (org != null)
{
PartnerOrganizations.Add(org);
}
}
Example: Using SecurityContext methods
// Allows you to check whether a user is in a role.
// CheckUserInAnyGlobalRoles()
// "GlobalRoles" really just means any role (built-in or custom).
if (!SecurityContext.Current.CheckUserInGlobalRole(SecurityContext.Current.CurrentUser, "Asset Viewers"))
{
// Add your logic here for handling insufficient permissions.
}
// Allows you to check whether the current user is in a role.
// CheckCurrentUserInAnyGlobalRoles()
List<SecurityRole> secure = new List<SecurityRole>();
secure.Add(new SecurityRole("Asset Viewers"));
if (!SecurityContext.Current.CheckCurrentUserInAnyGlobalRoles(secure))
{
// Add your logic here for handling insufficient permissions.
}
Last updated: Oct 21, 2014