Skip to main content

Setting up a filter under for a Field under Field Properties and I need to add 2 filters to that field with OR as the logic. It looks like there is no way to set the logic for these filters despite being able to add more than one.

My example is I need to restrict a Contact lookup to show contacts for the attached Account or that Account’s Parent Account. I believe I could work around this with a model that I lookup to, but it would be much easier to be able to apply filter logic here.

Is that something I should be able to do? If not, is there any chance of that being added in the future (near)?

Thanks
Adam

Adam,


I think that Lookup Filters are always applied using ‘AND’ logic. You are correct about being able to do this with a model. The lookup field can reference a model for its values. Here is a page that demonstrates this when creating a new Opportunity,


When the Account lookup field is changed, a model action loads an Account model to get that Account’s Id and ParentAccountId. A second model is then queried that pulls in the Contacts related to the Account or its Parent. Note that I am using a UI Only reference field for the Contact lookup.


Thanks,


Bill


<skuidpage unsavedchangeswarning="" personalizationmode="server" showsidebar="true" showheader="true" tabtooverride="Opportunity">
<models>
<model id="Opportunity" limit="1" query="false" createrowifnonefound="true" sobject="Opportunity" datasource="salesforce" type="">
<fields>
<field id="Name"/>
<field id="AccountId"/>
<field id="Account.Name"/>
<field id="Pricebook2Id"/>
<field id="Pricebook2.Name"/>
<field id="StageName"/>
<field id="CloseDate"/>
<field id="OwnerId"/>
<field id="Owner.Name"/>
<field id="UserPick" uionly="true" displaytype="PICKLIST" label="User Pick" ogdisplaytype="TEXT"/>
<field id="ContactLookup" uionly="true" displaytype="REFERENCE" label="Contact Lookup UI Only" ogdisplaytype="TEXT" datasource="salesforce" rel="Contact" keyfield="Id" targetobjects="Contact">
<batchfields>
<batchfield field="Name"/>
<batchfield field="Id"/>
</batchfields>
</field>
</fields>
<conditions/>
<actions>
<action>
<actions>
<action type="setCondition" model="SelectedAccount" condition="SelectedAccountId" value="{{AccountId}}"/>
<action type="requeryModel" model="SelectedAccount" behavior="standard"/>
<action type="requeryModel" model="AccountRelatedContacts" behavior="standard"/>
</actions>
<events>
<event>row.updated</event>
</events>
<fields>
<field>AccountId</field>
</fields>
</action>
</actions>
</model>
<model id="SelectedAccount" limit="1" query="false" createrowifnonefound="false" datasource="salesforce" type="" sobject="Account">
<fields>
<field id="RecordTypeId"/>
<field id="Id"/>
<field id="ParentId"/>
<field id="Parent.Name"/>
</fields>
<conditions>
<condition type="fieldvalue" value="" enclosevalueinquotes="true" field="Id" state="filterableoff" inactive="true" name="SelectedAccountId"/>
</conditions>
<actions/>
</model>
<model id="AccountRelatedContacts" limit="100" query="false" createrowifnonefound="false" datasource="salesforce" type="" sobject="Contact">
<fields>
<field id="Id"/>
<field id="Name"/>
</fields>
<conditions logic="1 OR 2">
<condition type="modelmerge" value="" field="AccountId" fieldtargetobjects="Account" operator="=" state="filterableon" inactive="false" name="AccountId" model="SelectedAccount" enclosevalueinquotes="true" mergefield="Id" novaluebehavior="noquery"/>
<condition type="modelmerge" value="" field="AccountId" fieldtargetobjects="Account" operator="=" state="filterableon" inactive="false" name="AccountIdParent" model="SelectedAccount" enclosevalueinquotes="true" mergefield="ParentId" novaluebehavior="noquery"/>
</conditions>
<actions/>
</model>
</models>
<components>
<pagetitle model="Opportunity" uniqueid="sk-3LJPQE-78">
<maintitle>
<template>New {{Model.label}}</template>
</maintitle>
<subtitle>
<template>{{Model.labelPlural}}</template>
</subtitle>
<actions>
<action type="savecancel" afterCancel="/{{Model.KeyPrefix}}/o" afterSave="/{{Id}}" rollbackonanyerror="true" uniqueid="sk-1SV5L9-194"/>
</actions>
</pagetitle>
<basicfieldeditor showsavecancel="false" showheader="true" model="Opportunity" mode="edit" uniqueid="sk-3LJPQE-79" buttonposition="">
<columns>
<column width="50%">
<sections>
<section title="Basics" collapsible="no">
<fields>
<field id="Name" uniqueid="sk-1SV5LL-203"/>
<field id="StageName" uniqueid="sk-1SV5LP-206"/>
<field id="CloseDate" uniqueid="sk-1SV5LU-209" valuehalign="" type=""/>
</fields>
</section>
</sections>
</column>
<column width="50%">
<sections>
<section title="Additional Info" collapsible="no">
<fields>
<field id="AccountId" valuehalign="" type="" optionsource="" uniqueid="sk-1SV5Lf-215">
<filters/>
<searchfields/>
<renderconditions logictype="and" onhidedatabehavior="keep"/>
</field>
<field uniqueid="sk-3XDQdg-520" id="ContactLookup" valuehalign="" type="" optionsource="model" pagesize="5" optionmodel="AccountRelatedContacts" displaytemplate="{{Name}}" searchtemplate="{{Name}}">
<searchfields/>
</field>
</fields>
</section>
</sections>
</column>
</columns>
</basicfieldeditor>
</components>
<resources>
<labels/>
<css/>
<javascript/>
<actionsequences uniqueid="sk-1SVBCy-256"/>
</resources>
<styles>
<styleitem type="background" bgtype="none"/>
</styles>
</skuidpage>