You can take a help of the following URL to get more insight about the code :-
https://localhost:8443/partymgr/control/EditPartyRelationships?partyId=admin Inside EditPartyRelationships.ftl file line # 103 partyIdFrom is passed as the hidden parameter to the service and the "partyId" has been set in the Screen definition. <input type="hidden" name="partyIdFrom" value="${partyId}"/> You may need to pass the partyIdFrom in your service map as its passed as the hidden field in the PartyRelationship screen that is present in Ofbiz. Please let us know if you are unable to find the way from my comments. -- Ashish On Fri, Jun 6, 2008 at 10:25 AM, RolandH <[EMAIL PROTECTED]> wrote: > Hi all, > > now I'm trying to add an relationship between two parties, using > createPartyRelationship from applications/party/servicedef/services.xml, the > description tells: > >> if partyIdFrom is not specified the partyId of the current userLogin will >> be used; >> > so, I'm trying: > > Map createPartyRelationshipMap = > UtilMisc.toMap( > "roleTypeIdTo", "CUSTOMER", > "userLogin", context.get("userLogin") > ); > [...] > createPartyRelationshipMap.put("partyIdTo", > createPersonResult.get("partyId")); > Map createPartyRelationshipResult = > dispatcher.runSync("createPartyRelationship", createPartyRelationshipMap); > if (ServiceUtil.isError(createPartyRelationshipResult)) { > throw new > GenericServiceException(ServiceUtil.getErrorMessage(createPartyRelationshipResult)); > } > > and I'm getting: > >> Failure in create operation for entity [PartyRelationship]: >> org.ofbiz.entity.GenericEntityException: Error while inserting: >> [GenericEntity:PartyRelationship][createdStamp,2008-06-06 >> 16:18:44.82(java.sql.Timestamp)][createdTxStamp,2008-06-06 >> 16:18:42.419(java.sql.Timestamp)][fromDate,2008-06-06 >> 16:18:44.811(java.sql.Timestamp)][lastUpdatedStamp,2008-06-06 >> 16:18:44.82(java.sql.Timestamp)][lastUpdatedTxStamp,2008-06-06 >> 16:18:42.419(java.sql.Timestamp)][partyIdTo,10210(java.lang.String)][roleTypeIdFrom,_NA_(java.lang.String)][roleTypeIdTo,CUSTOMER(java.lang.String)] >> (SQL Exception while executing the following:INSERT INTO >> public.PARTY_RELATIONSHIP (PARTY_ID_FROM, PARTY_ID_TO, ROLE_TYPE_ID_FROM, >> ROLE_TYPE_ID_TO, FROM_DATE, THRU_DATE, STATUS_ID, RELATIONSHIP_NAME, >> SECURITY_GROUP_ID, PRIORITY_TYPE_ID, PARTY_RELATIONSHIP_TYPE_ID, >> PERMISSIONS_ENUM_ID, POSITION_TITLE, COMMENTS, LAST_UPDATED_STAMP, >> LAST_UPDATED_TX_STAMP, CREATED_STAMP, CREATED_TX_STAMP) VALUES (?, ?, ?, ?, >> ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)(ERROR: null value in column >> "party_id_from" violates not-null constraint)). Rolling back transaction. >> > is the description wrong, or my understanding of the description? > > Greetings, > Roland >
