A decision node is a node which has one or more entry points and exactly two exit points: true and false. A decision node always has to have a script which has to return either true or false.
The ticket enters the decision node, then the script is executed and - depending on the result (true or false) - the ticket leaves the node via the respective exit point.
Figure 62: ConSol CM Process Designer - Decision node
A decision node has the following properties:
Figure 63: ConSol CM Process Designer - Decision node: Properties
In the following example, the system should automatically check if the customer (main contact of the ticket) is a VIP customer. If yes, the ticket should be marked with the VIP overlay (in the example a yellow star).
Figure 64: ConSol CM Admin Tool - Customer field "vip" in customer data
Figure 65: ConSol CM Web Client - Customer field "VIP" for customer/contact data
import com.consol.cmas.core.server.service.*
import com.consol.cmas.common.model.customfield.meta.UnitDefinitionType
def ticket = workflowApi.ticket
// fetch main contatc of the ticket
def maincontact = ticket.getMainContact()
def unit_type = maincontact.definition.type
log.info 'vipCheck: Unittype is ' + unit_type
log.info 'vipCheck: Unittype class is ' + unit_type.getClass()
if(unit_type == UnitDefinitionType.COMPANY) {
log.info 'No vipCheck for comapnies possible! Returning false ... '
return false
} else if (unit_type == UnitDefinitionType.CONTACT){
// fetch e-mail address of the man contact. The data object group field has to be addressed using data object group name:data object group field name
def vip_field
def custgroup = maincontact.customerGroup.name
println 'vipCheck: Customergroup is now ' + custgroup
switch(custgroup) {
case "Reseller": vip_field = "vip_person";
break;
case "DirectCustomers": vip_field = "vip_dircust"
break;
case "MyCustomerGroup": vip_field = "vip"
break;
case "OurPartnerCompanies": vip_field = "vip_partners"
break;
case "RetailCustomers": vip_field = "retail_vip"
break;
}
def vip_value = maincontact.get(vip_field)
log.info 'VIP is now ' + vip_value
if (vip_value){
return true
} else {
return false
}
}
Code example 6: Precondition script: activity should only be displayed for VIP customers
Figure 66: ConSol CM Web Client - Ticket icon with VIP overlay