[SalesForce] Junction Object Lookup field

I have the following structure:

Authority__c-----------------ContractToAuthotiy__c --------------------Contract__c
StartDate__c (Date)           Authority__c (MD Lookup)                  ContractStart__c
                              Contract__c (MD Lookup)       

So, Authority__c and Contract__c are custom objects, and ContractToAuthority__c is the junction object.
When I create a Contract, I need to add authorities to the contract, and these authorities must fulfill the following criteria: Authority__c.StartDate__c < Contract__c.ContractStart__c.
When the user adds a new authority to the contract, I want to filter the Authority__c Lookup field based on that criteria. Is that possible? Tia.

Best Answer

I believe there are 2 ways to do this - 1. Bad one: use custom settings to store Contract__c.ContractStart__c and use it in the lookup filter for Authority__c (MD Lookup) 2. Better one: create a direct lookup relation between Authority__c and Contract__c so you will have both the fields in the lookup filter for Authority__c (MD Lookup)

let me know which one you use and why..

Related Topic