Caching problem with ObjectPicker and pre-defined filters

I think I have run into a caching problem with the object picker form control where the attribute useCache="false" seems to be not working. So here’s my scenario:

In our app we have an object “EventArticle” that has a relation to object “ErpEvent”.

I want to use object picker to present a list of all ErpEvents that are referenced by any EventArticle.

I defined a filter in Config.cfc like this:

settings.filters.pricelists = {
      filter : "EXISTS( SELECT 1 FROM pobj_eventarticle WHERE eventId = ErpEvent.id )"
}

and then I use the object picker form control like this:


<field name="pricelist"   sortorder="10"    control="objectPicker"    object="ErpEvent"   objectFilters="pricelists" required="true" useCache="no" />

The problem is that the result of the first element call is always re-delivered, even if the result set has changed in the meantime.

I played around with ObjectPicker.cfc and finally changed line 29 to
var prefetchCacheBuster = getTickCount();
and the problem was gone. To me that seems to confirm it is a caching problem.

Could it be the problem is caused by using a standard SQL clause for the filter and not a proper ORM clause? How should I go about this, please?

Thank you in advance!

This sounds like a client-side caching issue. The object picker uses libraries that use local object storage for prefetched results.

Are there a lot of results? If not, could possibly try ajax="false" and I believe that client side caching would not come into play then.

Thank you @dominic.watson, it was indeed a client side caching problem and ajax"false" solved it. :wink:

1 Like