+ Start a Discussion
SATZSATZ 

Filter condition for date field

Hi all,
I am using class object as lookupfield in Enrollment object.Both are custom object.
For class i want to add a filter condition the Class start date and time is equal to today .
here i want  to specify today date and timecompare date and time or date
But It shows error .

Shukla_AnkitShukla_Ankit

Hello,

 

That error occur because Today is not a write value of the date/time field you have to mention particular date and time to compare.

 

Thanks

 

Ankit

goabhigogoabhigo

Is Start Date/Time a DateTime datafield? It looks like so..

 

To my knowledge SFDC doesn't support date functions in lookup filters. So you have to create a formula field of type date/datetime depending on data type of Start Date/Time field and use values - Today() or Now().

Then use this field in the criteria

Class: Start Date/Time     equals    Field     The_Formula_Field__c

 

Does this help? Let me know.

goabhigogoabhigo

I think formula field may not help, as they are filled after the record is saved.

 

Looks like there is no straight forward solution for this :(

May have to use VF pages with some javascripts.

@anilbathula@@anilbathula@

Hi Satz

 

There are lot of limitations on lookup filters in salesforce where we cant use the date fileds,month etc :

 

  • Lookup filter criteria can reference fields on accounts, assets, contacts, entitlements, quotes, service contracts, users, and custom objects, with the following exceptions:
    • Relationship fields on activities
    • System fields that are always read only, such as Created By and Modified By
    • Relationship fields that support queues, such as Case Owner, Lead Owner, and Delegated Approver
  • Each object can have up to five active required lookup filters and an unlimited number of optional lookup filters. If you reach the limit of required lookup filters for an object, create optional filters instead and use validation rules to enforce your business rule when a user saves.
  • Lookup filters on currency fields don't convert currencies. For example, if your organization uses multiple currencies and a lookup filter criteria is Expected Revenue greater than 100000, the lookup shows all records with an Expected Revenue field value greater than 100,000, regardless of the currency.
  • You can't use special date values, such as “Today” or “This Month,” in lookup filter criteria.
  • You can't delete fields that are referenced in an active lookup filter.
  • You can't change the field type of fields referenced by an active lookup filter.
  • For more info please click this link:-https://login.salesforce.com/help/doc/en/fields_lookup_filters_notes.htm
Zach HutchinsZach Hutchins
Yeah you can use datetime conditions in your filters, has to be in this format though 7/17/2016 12:00 AM or 7/17/2016. Just use the regular operators with it =,>,or <.