GenericValue newPartyContactMechPurpose = delegator.makeValue("PartyContactMechPurpose",
UtilMisc.toMap("partyId", partyId, "contactMechId", contactMechId, "contactMechPurposeTypeId", contactMechPurposeTypeId,
"fromDate", fromDate));
try {
delegator.create(newPartyContactMechPurpose);
} catch (GenericEntityException e) {
Debug.logWarning(e.getMessage(), module);
Map messageMap = UtilMisc.toMap("errMessage", e.getMessage());
errMsg = UtilProperties.getMessage(resource,"contactmechservices.could_not_add_purpose_write", messageMap, locale);
return ServiceUtil.returnError(errMsg);