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
Michelle ArndtMichelle Arndt 

Syntax Error

IF(LastActivityDate <= 90 Day, checked = true, checked = false)
Can someone please help me with this formula? I am getting a syntax error and I think it might have to do with the day, but not 100% sure.
Best Answer chosen by Michelle Arndt
Mayank Srivastava 28Mayank Srivastava 28
Ah I had a brain freeze there and compared the date value with a number. Sorry! Use the following:
(TODAY() - LastActivityDate) <= 90

 

All Answers

AbdelhakimAbdelhakim
Hi Micehlle,
You can find the answer in this link
https://help.salesforce.com/HTViewHelpDoc?id=formula_examples_dates.htm

Please mark it as a best answer if it helps.
Thanks,
Michelle ArndtMichelle Arndt
So I now have the formula as:

IF(DATEVALUE(LastActivityDate) <= 90, checked = true, checked = false)

and I am getting this error

Error: Incorrect argument type for function 'DATEVALUE()'.

I also changed it to 
DATEVALUE(LastActivityDate) <= 90
and received the same error message
Mayank Srivastava 28Mayank Srivastava 28
Ah forgot that LastActivityDate is already a date field. Try this:
IF(LastActivityDate <= 90,TRUE, FALSE)

You don't need the checked = true, checked = false,just TRUE and FALSE.
Also make sure that your formula field is of type checkbox.
Michelle ArndtMichelle Arndt
IF(LastActivityDate  <= 90,TRUE, FALSE)
Error: Incorrect parameter type for operator '<='. Expected Date, received Number

What I'm hoping to acheive is it for it check the box if there has been activity withing the last 90 days.

I feel like we're so close!
Mayank Srivastava 28Mayank Srivastava 28
Ah I had a brain freeze there and compared the date value with a number. Sorry! Use the following:
(TODAY() - LastActivityDate) <= 90

 
This was selected as the best answer
Michelle ArndtMichelle Arndt
No errors...yaaay!  Will this then check the box if there is activity within the last 90 days?
Mayank Srivastava 28Mayank Srivastava 28
Yep.
Last Activity shows when someone in your Organization last did something related to the record. It represents one of the following:
 
The latest Due Date of the closed tasks on a record. 
The latest Date of events on a record.
Michelle ArndtMichelle Arndt
Thank you SO much.