Hi Pranay,

thanks for your answer, after this mail i found my real solution:

   Map createPartyEmailAddressMap =
       UtilMisc.toMap(
              "emailAddress", context.get("emailAddress"),
              "contactMechPurposeTypeId", "PRIMARY_EMAIL",
              "userLogin", context.get("userLogin")
              );
userLogin holds the actual user, if I read existing code correctly.

Thanks for your help,
Roland

Pranay Pandey wrote:
I hope this will be of help.
The service you are calling is createPartyEmailAddress requires
authentication so you need to send the userLogin value to it.
Something like this:

// perform actions as the system user
            GenericValue userLogin =
delegator.findByPrimaryKeyCache("UserLogin", UtilMisc.toMap("userLoginId",
"system"));

            input = UtilMisc.toMap("userLogin", userLogin, "emailAddress",
email, "partyId", "_NA_", "fromDate", fromDate, "contactMechPurposeTypeId",
"OTHER_EMAIL");
            Map serviceResults =
dispatcher.runSync("createPartyEmailAddress", input);
            if (ServiceUtil.isError(serviceResults)) {
                throw new
GenericServiceException(ServiceUtil.getErrorMessage(serviceResults));
            }

Reply via email to