I'm trying to invoke deletePartyRole (simple method defined in PartyServices.xml) to remove roles from a Party:

roles = delegator.findListIteratorByCondition("RoleTypeAndParty", new EntityExpr("roleTypeId", EntityOperator.LIKE, "ACCT_TYPE%"),
                   UtilMisc.toList("roleTypeId"),
                   null);

           if (roles == null) {
               roles.close();
           } else {
               GenericValue nextRole;
               while ((nextRole = (GenericValue) roles.next()) != null) {
                   String roleTypeId = (String) nextRole.get("roleTypeId");
                   if (roleTypeId != null) {
                       // delete this role
dispatcher.runSync("deletePartyRole", UtilMisc.toMap("login.username", userLoginId, "login.password", currentPassword, "roleTypeId",roleTypeId));
                   }
               }
               roles.close();
           }

On the first pass through, one role is matched by the EntityListIterator and roleTypeId is set correctly to the roleTypeId of a role belonging to that Party, and passed into "deletePartyRole".

"deletePartyRole" comes back with "Error in simple-method [Delete a PartyRole [file:/Users/ryan/svn/website/trunk/ofbiz/applications/party/script/org/ofbiz/party/party/PartyServices.xml#deletePartyRole]]: In remove-value a value was not found with the specified valueAcsr: partyRole, not removing"

which is because in RemoveValue.java, line 49,
    GenericValue value = (GenericValue) valueAcsr.get(methodContext);
is returning null.

What I can't work out is why?

any thoughts?

regards,
-Ryan

Reply via email to