question: public static Map < String , Object > copyPartyContactMechs ( DispatchContext dctx , Map < String , ? extends Object > context ) { Delegator delegator = dctx . getDelegator ( ) ; LocalDispatcher dispatcher = dctx . getDispatcher ( ) ; GenericValue userLogin = ( GenericValue ) context . get ( "userLogin" ) ; String partyIdFrom = ( String ) context . get ( "partyIdFrom" ) ; String partyIdTo = ( String ) context . get ( "partyIdTo" ) ; Locale locale = ( Locale ) context . get ( "locale" ) ; try { List < Map < String , Object > > valueMaps = ContactMechWorker . getPartyContactMechValueMaps ( delegator , partyIdFrom , false ) ; for ( Map < String , Object > thisMap : valueMaps ) { GenericValue contactMech = ( GenericValue ) thisMap . get ( "contactMech" ) ; GenericValue partyContactMech = ( GenericValue ) thisMap . get ( "partyContactMech" ) ; List < GenericValue > partyContactMechPurposes = UtilGenerics . checkList ( thisMap . get ( "partyContactMechPurposes" ) ) ; String contactMechId = contactMech . getString ( "contactMechId" ) ; Map < String , Object > serviceResults = dispatcher . runSync ( "createPartyContactMech" , UtilMisc . < String , Object > toMap ( "partyId" , partyIdTo , "userLogin" , userLogin , "contactMechId" , contactMechId , "fromDate" , UtilDateTime . nowTimestamp ( ) , "allowSolicitation" , partyContactMech . getString ( "allowSolicitation" ) , "extension" , partyContactMech . getString ( "extension" ) ) ) ; if ( ServiceUtil . isError ( serviceResults ) ) { return serviceResults ; } for ( GenericValue purpose : partyContactMechPurposes ) { Map < String , Object > input = UtilMisc . toMap ( "partyId" , partyIdTo , "contactMechId" , contactMechId , "userLogin" , userLogin ) ; input . put ( "contactMechPurposeTypeId" , purpose . getString ( "contactMechPurposeTypeId" ) ) ; serviceResults = dispatcher . runSync ( "createPartyContactMechPurpose" , input ) ; if ( ServiceUtil . isError ( serviceResults ) ) { return serviceResults ; } } } } catch ( GenericServiceException e ) { Debug . logError ( e , e . getMessage ( ) , module ) ; return ServiceUtil . returnError ( UtilProperties . getMessage ( resource , "PartyCannotCopyPartyContactMech" , UtilMisc . toMap ( "errorString" , e . getMessage ( ) ) , locale ) ) ; } return ServiceUtil . returnSuccess ( ) ; }
target:  Copies all contact mechs from one party to another. Does not delete or overwrite any contact mechs.