Salesforce: Implementing Search Filter on Dayback Calendar When Searching Related To Records
Salesforce Dayback Calendar (Version 1.17) allows you to do a search over the related to record. This is pretty similar to the Salesforce standard event “Related To” lookup.
The default behavior of the lookup is to search across all records based on the object it is configured with. For example the following configuration indicates that the Dayback is related to Opportunity:
However, there is a requirement that the search should only search on records that fulfill certain criteria. Using the example above, the related to lookup should only list opportunity that is not “Closed Won” or “Closed Lost”. Which without making any changes, it would result as per the following for example:
To navigate around this, consider the following:
- Create a custom formula field that prints the name of the record (or any other terms that you want to list out as the related to search result) only when it meets the criteria. In our example, our formula should only print Opportunity Name when the Opportunity record is not Closed Won or Closed Lost otherwise it would be left blank. Example Formula: IF(OR(ISPICKVAL(StageName, “Closed Won”), ISPICKVAL(StageName, “Closed Lost”)), NULL, Name) and also assuming the custom field name is called “Dayback_Name_Filter__c”
- In Dayback, configure under the “Project Objects” section so that the “Search Field” should reference the formula field instead. This is to tell Dayback, when doing a search against Opportunity (in our example), lookup record based on terms search via this field.
Therefore, Dayback would only search based on the field when values appear on the field plus it matches the search term.