Skip to Content
1
Aug 21, 2017 at 02:33 PM

referenceSearchCondition on relations

737 Views

Due to not yet implemented functionality in Backoffice, B2BUnit.billingAddress (and other Address references) doesn't filter billing addresses of the particular B2BUnit. Instead it will offer to select from all available addresses in the system.
https://answers.sap.com/questions/12762488/isselectionof-in-backoffice.html

As a workaround, I was trying to filter the reference editor to select only the Addresses where the current B2BUnit is the owner.
For that, I would use set the referenceSearchCondition property to the editor. Something like this:

 <context merge-by="type" parent="UserGroup" type="Company" component="editor-area" module="mybackofficeextension">
     <editorArea:editorArea xmlns:editorArea="..." name="">
         <editorArea:tab name="hmc.addresses" position="2" merge-mode="replace">
             <editorArea:section name="hmc.addresses">
                 <editorArea:attribute qualifier="shippingAddress" editor="com.hybris.cockpitng.editor.defaultreferenceeditor">
                     <editorArea:editor-parameter>
                         <editorArea:name>referenceSearchCondition_owner</editorArea:name>
                         <editorArea:value>{parentObject}</editorArea:value>
                     </editorArea:editor-parameter>
                 </editorArea:attribute>
             </editorArea:section>
         </editorArea:tab>
     </editorArea:editorArea>
 </context>

But that results in an java.lang.IllegalArgumentException: GenericSubQueryCondition is only compatible with following operators: [IN, NOT_IN, EXISTS, NOT_EXISTS] error.

I have also tried with referenceSearchCondition_owner_in but then I get java.lang.IllegalStateException: Unsupported operator IN for references.

Any idea on how to make that referenceeditor list only addresses of the B2BUnit?