Hi all,
I have a lookup field displayed in a ADF LOV component in the user create form. I need to filter the entries of that ADF LOV component. I tried to do that with a managed bean that, when the popup of the component is displayed, catches the LaunchPopupEvent and it resets the ViewCriteria and re-creates another one ViewCriteria with only items that I need. The code is like that:
public void lovPopupListener(LaunchPopupEvent launchPopupEvent) {
logger.log(Level.INFO,"START lovPopupListener " );
logger.log(Level.INFO,"lovPopupListener - Setting binding context to Identity_Console__c...");
BindingContext bctx = BindingContext.getCurrent();
BindingContainer bindings = bctx.getCurrentBindingsEntry();
JUCtrlListBinding lov = (JUCtrlListBinding)bindings.get("Identity_Console__c");
logger.log(Level.INFO,"lovPopupListener - Creating new viewCriteria...");
ViewCriteriaManager vcm = lov.getListIterBinding().getViewObject().getViewCriteriaManager();
vcm.removeViewCriteria(vcm.DFLT_VIEW_CRITERIA_NAME);
ViewCriteria vc = new ViewCriteria(lov.getListIterBinding().getViewObject());
vc.setName(vcm.DFLT_VIEW_CRITERIA_NAME);
logger.log(Level.INFO,"lovPopupListener - viewCriteria vc = " + vc.toString());
ViewCriteriaRow vcr = new ViewCriteriaRow(vc);
vcr.setAttribute(1, "Administrators");
logger.log(Level.INFO,"lovPopupListener - Added row " + vcr.toString() + "to the viewCriteria");
vc.addRow(vcr);
logger.log(Level.INFO,"lovPopupListener - viewCriteria (after item add vc) = " + vc.toString());
logger.log(Level.INFO,"lovPopupListener - Applying view criteria to view...");
lov.getListIterBinding().getViewObject().applyViewCriteria(vc);
}
This should delete the view of the entries of the lookup in the popup and should show me only the "Administrators" one. But it doesn't work, and I see all the entries of the lookup, even if, in the log, I see that this method is called and it resets the viewCriteria.
Is there any other way to filter the values of a lookup field?
Or is there any way to show in the user create form a text field in a ADF LOV Component and to set the choices of that LOV Component with a managed bean?
Thanks in advance