Since version 6.9.0, ConSol CM offers customer relations. In older versions, this feature is not available!
To be able to work with customer relations, you have to have a profound knowledge of the FlexCDM, the ConSol CM Flexible Customer Model. Please refer to the ConSol CM Administrator Manual for a detailed introduction. Since a customer is represented by the class Unit in CM programming, the terms customer relation and unit relation are synonyms.
Three objects are essential:
Object |
Java class |
Admin Tool description |
Explanation |
---|---|---|---|
Customer |
Unit |
<none> |
The general description or the general object which represents a customer, i.e. some person (contact) or company or another object on company or contact level which is registered in the CM database |
Company |
Unit |
Customer object of type company |
An object on company level (i.e. the highest level in the customer model). This can be a real company or this can be a machine or another object which represents the level. An object on the company level can be the parent level for an object on the contact level. |
Contact |
Unit |
Customer object of type contact |
An object on contact level (i.e. the lowest level in the customer model). This can be a real person or another object which represents the level. An object on the contact level can be a stand-alone object (in a one-level customer model) or can belong to a company level object. |
Keep in mind that the main customer of a ticket can be a contact or a company! The method used is ticket.getMainContact(). This returns an object of class Unit. The object can be a contact or a company!
Customer relations represent relations between customers, i.e. companies and contacts.
They can be:
A relation is of one of the following types:
In the programming interface, a customer object (i.e. a contact or a company) is represented by an object of the class Unit.
Figure 145: Customer relations in ConSol CM
To work with unit relations in workflow scripts, make sure you have established and configured all required relations using the Admin Tool before you start programming.
In this book we sometimes use the terms customer and customer definition which are part of the customer model of ConSol CM (FlexCDM). However, the names of the corresponding Java classes are Unit and UnitDefinition. All other Java classes which deal with customer objects are also named Unit... . Please keep that in mind when you work on the administrator level as well as on the programmer's level. Please refer to the ConSol CM Java API documentation for details.
In the following example, a relation has been defined in the Admin Tool to reflect a reseller - end customer relation. A company of the customer group Reseller sells products to a customer (a person, a contact) of the customer group DirectCustomers.
Figure 146: ConSol CM Admin Tool - Definition of reseller - end customer relation
A ticket is created with a main customer. This customer is an employee of a reseller company. The end customer to whom the reseller company sells products is added as additional customer in the role end customer to the ticket. The engineer who works on the ticket should be able to create a relation between the reseller company (source) and the end customer person (target) using a workflow activity.
Figure 147: ConSol CM Web Client - Example ticket with main customer and one additional customer
In the Service Desk workflow, there is a workflow activity Add RESELLER-END CUSTOMER relation (see next figure).
Figure 148: ConSol CM Process Designer - Workflow activity for adding a unit relation
The following script is used in the workflow activity Add RESELLER-END CUSTOMER relation:
// get Company of the main customer of the ticket, this is the RESELLER company
def maincust = ticket.mainContact
def unit_type = maincust.definition.type
log.info 'TYPE is now : ' + unit_type
def comp
if(unit_type == UnitDefinitionType.CONTACT) {
comp = maincust.get("company()")
} else if (unit_type == UnitDefinitionType.COMPANY){
comp = maincust
}
// works only for Resellers!
def custGroup = comp.customerGroup.name
if (custGroup.equals("Reseller")){
def end_custs = ticket.getContacts("end customer").each() { e_cust ->
log.info "E_CUST is now " + e_cust.get("DirCustCustomerData.dir_cust_customer_name")
//build all components for new unit relation
// -- get the unit definitoin
def unitrel_def = unitRelationDefinitionService.getByName("ResellerDirectCustomersRelation")
def new_rel = new UnitRelation(unitrel_def, comp, e_cust, "This Reseller sells to the end customer")
def new_rel2= unitRelationService.create(new_rel)
}
} else {
workflowApi.addValidationError("INFO", "Please set Reseller Company or contcat as main customer first.")
}
Code example 78: Adding a data object relation using a workflow script
When the engineer has executed the workflow activity, the relation from the reseller company to the end user has been established.
Figure 149: ConSol CM Web Client - New unit relation (created by workflow script)
Java class | Explanation |
---|---|
Unit
|
A customer object (unit): a contact or a company. |
UnitRelation
|
A relation between two customer objects (units). Visible in the Web Client on the contact or company page under Relations. |
UnitRelationDefinition
|
The definition of a unit relation as configured in the Admin Tool under User attributes - Data object relations (CM version 6.9) or Customers - Relations (CM version 6.10). A |
UnitRelationDefinitionService
|
Singleton. Available as object |
UnitRelationService
|
Singleton. Available as object |