function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Ishan Singh 4Ishan Singh 4 

I have a formula field of type date. I want a task to be created using batch class when the date in formula field is today. But my code is not working

Date Todaydate;
    if ( l.Age__c == Todaydate)

Age__c is formula field
my query parameter is correct
Using debug log I found code is not going below "if"
Agustin BAgustin B
Hi Ishan, I see no issue there, what is above the Date line? Is the code executing there? Try with a system debug. 
Maybe you are not even getting inside de batch at all or the "I" record is not filling properly.

Please post entire code relevant to the issue so I can help better.

Also like or mark as correct if i am being helpfull, it may help others.
David Zhu 🔥David Zhu 🔥
@Ishan, you may check if  l.Age__c is a datatime data type field. 
When datetime value compares date value, it won't have parsing issue. But you won't get the expected result.