Found my problem.

It was my form, I was using 'display-entity' instead of 'display' for the
field.

e.g
<field name="firstName"><display-entity entity-name="Person"/></field>
Changed it to
<field name="firstName"><display entity-name="Person"/></field>
and now the form works fine I can retrieve the data for the logged in user
from the person entity.



> Hi. I think your problem is that youre not passing the partyId value or
> its
> value is null. First, entity-one needs you to provide all primary keys for
> it to return something (hence the error: [GenericDelegator.
> findByPrimaryKey] Passed primary key is not a valid primary key:...)
> Second,
> youre not passing the partyId because this userLogin is null. At least
> from
> the snippet that you provided, userLogin is not defined anywhere. If youre
> intention was to retrieve the userLogin value of the currently logged in
> account, then you should retrieve the partyId this way:
> <set field="partyId" value="${*parameters.*userLogin.partyId}"/>
> Hope this helps.
>
> ~ ian
>
> On Mon, Aug 18, 2008 at 5:32 AM, Milind W <[EMAIL PROTECTED]>
> wrote:
>
>> hi,
>> I think someone who understands the findParty method is probably the
>> best
>> person to answer this.
>> I have a screen and form as detailed below.
>> I am trying to get the data from the person entity for the logged in
>> user
>> and display it in a form.
>> Am I missing some parameters? or something else?
>> I am trying to debug this looking at the existing screens and forms but
>> if
>> someone who understands this method can help, I would appreciate it.
>> Thanks
>> -Milind
>>
>>
>> The error:
>>
>> org.ofbiz.base.util.GeneralException: Error rendering screen
>> [component://ebp/widget/EBPScreens.xml#main]:
>> org.ofbiz.base.util.GeneralException: Error rendering screen
>> [component://ebp/widget/EBPScreens.xml#main-decorator]:
>> java.lang.IllegalArgumentException: Error getting value from the
>> database
>> for display of field [firstName] on form [profile]:
>> org.ofbiz.entity.GenericModelException:
>> [GenericDelegator.findByPrimaryKey] Passed primary key is not a valid
>> primary key: [GenericEntity:Person][firstName,THE(java.lang.String)]
>> (Error getting value from the database for display of field [firstName]
>> on
>> form [profile]: org.ofbiz.entity.GenericModelException:
>> [GenericDelegator.findByPrimaryKey] Passed primary key is not a valid
>> primary key: [GenericEntity:Person][firstName,THE(java.lang.String)])
>> (Error rendering screen
>> [component://ebp/widget/EBPScreens.xml#main-decorator]:
>> java.lang.IllegalArgumentException: Error getting value from the
>> database
>> for display of field [firstName] on form [profile]:
>> org.ofbiz.entity.GenericModelException:
>> [GenericDelegator.findByPrimaryKey] Passed primary key is not a valid
>> primary key: [GenericEntity:Person][firstName,THE(java.lang.String)]
>> (Error getting value from the database for display of field [firstName]
>> on
>> form [profile]: org.ofbiz.entity.GenericModelException:
>> [GenericDelegator.findByPrimaryKey] Passed primary key is not a valid
>> primary key: [GenericEntity:Person][firstName,THE(java.lang.String)]))
>>
>>
>> The Screen:
>>    <screen name="main">
>>        <section>
>>            <actions>
>>                <set field="headerItem" value="Main"/>
>>                                <set field="roleTypeId" value="CONTACT"/>
>>                <set field="partyTypeId" value="PERSON"/>
>>                <set field="headerItem" value="Contacts"/>
>>                                <set field="partyId"
>> value="${userLogin.partyId}"/>
>>                                <set field="lookupFlag" value="Y"/>
>>                                <set field="extInfo" value="N"/>
>>                                <set field="roleTypeId" value="ANY"/>
>>                                <entity-one entity-name="Person"
>> value-name="Person" />
>>            </actions>
>>            <widgets>
>>                <decorator-screen name="main-decorator"
>> location="component://ebp/widget/EBPScreens.xml">
>>                                           <decorator-section
>> name="body">
>>                        <section>
>>
>>                            <actions>
>>                                <service service-name="findParty"
>> auto-field-map="true"/>
>>                            </actions>
>>                            <widgets>
>>                                <container style="screenlet">
>>                                    <container style="screenlet-body">
>>                                        <section>
>>                                            <condition>
>>                                                <not><if-empty
>> field-name="partyList"/></not>
>>                                            </condition>
>>                                            <widgets>
>>                                                <include-form
>> name="profile"
>> location="component://ebp/widget/EBPForms.xml"/>
>>                                            </widgets>
>>                                            <fail-widgets>
>>                                                <container style="h3">
>>                                                    <label
>> text="PARTY_NOT_FOUND"/>
>>                                                </container>
>>                                            </fail-widgets>
>>                                        </section>
>>                                    </container>
>>                                </container>
>>                            </widgets>
>>                        </section>
>>                    </decorator-section>
>>                </decorator-screen>
>>            </widgets>
>>        </section>
>>    </screen>
>>
>> The FORM:
>>    <form name="profile" type="list" target="Person"
>> default-entity-name="Person"   >
>>                <actions>
>>            <entity-condition entity-name="Person">
>>                <condition-expr field-name="partyId"
>> value="${userLogin.partyId}"/>
>>                <order-by field-name="partyId"/>
>>            </entity-condition>
>>                        <entity-one entity-name="PartyType"
>> value-name="partyType">
>>                <field-map field-name="partyTypeId"
>> env-name="partyRow.partyTypeId"/>
>>            </entity-one>
>>        </actions>
>>                <field name="partyId" title="PartyId" ><display-entity
>> entity-name="Person"/></field>
>>                <field name="firstName"><display-entity
>> entity-name="Person"/></field>
>>                <field name="middleName"><display-entity
>> entity-name="Person"/></field>
>>                <field name="lastName"><display-entity
>> entity-name="Person"/></field>
>>                <field name="personalTitle"><display-entity
>> entity-name="Person"/></field>
>>                <field name="gender"><display-entity
>> entity-name="Person"/></field>
>>                <field name="birthDate"><display-entity
>> entity-name="Person"/></field>
>>                <field name="occupation"><display-entity
>> entity-name="Person"/></field>
>>                <field name="lastModifiedDate"><display-entity
>> entity-name="Person"/></field>
>>                <field name="lastModifiedByUserLogin"><display-entity
>> entity-name="Person"/></field>
>>        </form>
>>
>>
>>
>>
>


Reply via email to