This is in a custom screen (not part of ofbiz) that edits
products/prices/vendors/inventory/etc all in a single screen.  One of the
parameters in the parameter map of this screen is facilityId (used for
inventory).  facilityId is also a field in Product table.

In this custom screen, I replaced the existing productId lookup field with
<@htmlTemplate.lookupField ... fieldFormName="LookupProduct"/>  to be able
to get autocompletion.  However, when I first tried it, I got no results
even though I used well known productIds.  A little investigation turned up
the problem to be with performFind.  LookupProducts has two forms,
lookupProduct and listLookupProduct, both in
product\widget\catalog\LoookupScreens.xml.  The second, listLookupProduct
calls the service performFind with all parameters as the inputFields
argument to that service.  However, because facilityId is in the parameter
map, performFind finds that as a valid field in Product table and adds it to
the query.  Once again, because I do not use facilityId for my Product
table, no results were returned.

The screen LookupProduct in LookupScreens.xml defines a <set
field="searchFields".  However, this value is not used anywhere I can find
and specifically is not used in the performFind service.  I simply added
searchFields as an optional argument to the performFind servoce and in the
performFind java code, used it if it existed by extracting just those values
from the inputFields map.  Works a charm, but I am trying to find an OOTB
solution because the next time I upgrade ofbiz, this code change will go
away.

This will be a problem to anyone using any of the lookup services in a
custom app where there may be an unintended field in the parameter map.

Skip

-----Original Message-----
From: Pierre Smits [mailto:pierre.sm...@gmail.com]
Sent: Monday, July 08, 2013 6:11 AM
To: user@ofbiz.apache.org
Subject: Re: Error (for me only probably) LookupProduct screen


Skip,

In what component are you using the LookupProduct functionality where it
doesn't deliver the expected result?

Regards,

Pierre Smits

Reply via email to