I'm the PM for lookups in Lightning. First, I would look at your current lookup filter setup. Are they working as is? If you want to speed up Lightning or S1 adoption, try adjusting your lookup filters to not be reliant on a specific value in the field you are adding or updating.
We launched Lightning with related lookup filters support, which is by far most what admins add to their orgs. We even added support for related lookup filters Salesforce1 in Winter ’17. We think that’s a huge step in the right direction for productivity.
But, we hear you loud and clear. The lack of dependent lookup filters has been a frustrating gap. We are working on adding support for dependent lookup filters, so you’ll be able to apply your business rules automatically in the Spring '17 release. As always, #safeharbor applies, of course!
Figured out a method around the filter madness. A few related questions (Problem with Visualforce Page and Field Filters based on RecordType, Account lookup on Opportunity not filtered correctly from Visualforce page) showed up in my first searches on the matter, but I dismissed them due to the questions referring to a RecordType in the filter, not a related object.
After a bit more research, I ended up clicking on one and found the solution to both of those seemed to be adding apex:inputField value="{!SomeObject.RecordTypeId}"
to the page, somewhere. It seems as though adding the object to the visualforce layout allows Salesforce to access the data used for the lookup filter, otherwise, it has no data for those fields, despite the data being present in the controller.
Following this logic, placing the related id field for the object being filtered in the lookup would allow the visualforce to have access to the objects data, regardless of the type (RecordTypeId
or CampaignId
). A quick test with the field on the layout confirmed that adding the related object lookup onto the visualforce layout re-enables the filter functionality.
Ultimately, I ended up placing the field outside of the apex:pageBlockSection
, and hiding it in a hidden div
.
<apex:page controller="ClassFilterTestController">
<apex:pageBlock>
<apex:form>
<div style="display: none;">
<apex:inputField value="{!ChildCampaign.ParentId}" />
</div>
<apex:pageBlockSection>
<apex:inputField value="{!ChildCampaign.Class__c}" />
</apex:pageBlockSection>
</apex:form>
</apex:pageBlock>
</apex:page>
Interestingly, using the standard controller on the page does not perform correctly. My assumption would be that the Standard Controller would be able to access the data easily, and allow the filter through, without it being on the page, but that seems to be incorrect.
Best Answer
You could consider a writeable
Is_Active__c
checkbox field, which you can then turn to false using aTime Based Workflow Rule
. That way, you should be able to include the field in your filter, but still have it indicate whether or not the expiration date has passed.