[closed] ftLibraryDataSQLWhere not working in wizard


I’m trying to use ftLibraryDataSQLWhere to limit library data to a subset. Here’s what I’m doing

stPropMetadata = structNew();
stPropMetadata.aSupplierContactIDs.ftLibraryDataSQLWhere="objectID IN (#quotedValueList(qSupplierContacts.objectID)#)";

<wiz:object objectID="#stWizard.PrimaryObjectID#" lfields="aContactIDs,aSupplierContactIDs" legend="Kontaktpersoner" stPropMetadata="#stPropMetadata#" />

The label property is used, so passing in stPropMetadata works, but ftLibraryDataSQLWhere is not picked up

For testing purposes you can also do:

stPropMetadata.aSupplierContactIDs.ftLibraryDataSQLWhere="1 = 2";

This should prevent any items in the library list - but the full set is still returned.


I think the root cause is that the stPropMetadata attributes can’t be passed all the way through to the fourq/displayLibrary webskin that is used to render the library picker (since it’s loaded in a subsequent request after the user clicks the “Select” button, and it’s probably not ideal to try to pass that data via the ajax request)… So the custom stPropMetadata probably works for drop downs and checkbox render types, but not for library pickers.

You should be able to work around this by adding a ftLibraryData attribute to your aSupplierContactIDs property in your content type to specify a method to use for the lookup as this function should always be available, e.g. ftLibraryData="getSupplierContactIDs" with a corresponding method;

<cffunction name="getSupplierContacts" access="public" output="false" returntype="query">
	<cfargument name="primaryID" type="string" required="true">

	<cfset var qResult = application.fapi.getContentObjects(typename="yourContentType", lProperties="objectid,label", objectid_IN=getSupplierContactsFor(arguments.primaryID))>

	<cfreturn qResult />

(You’d also need an additional method such as getSupplierContactsFor to look up the valid objectid’s for your current object – arguments.primaryID should bu the objectid of the object that is being edited).

Hope that helps, let me know if you have further issues :slight_smile:


I don’t think its likely custom stPropMetadata will be extended into the library pickers; you can set different defaults but not “just in time” changes. I suspect on those occasions where a default doesn’t work, building a custom library picker is probably easier.

Have flagged this issue as closed.