You need to sign in to do that
Don't have an account?
Steven Benson
addMonths sytax error
HI guys im trying to create a forumla on a VP page that shows an image based on a date
value="{!If(Account.LatestCompaintDate__c = System.now().addMonths(-6), $Resource.xxx,"")}"
but for some reason i get a missing ')' error
any help would be great!
value="{!If(Account.LatestCompaintDate__c = System.now().addMonths(-6), $Resource.xxx,"")}"
but for some reason i get a missing ')' error
any help would be great!
Sorry I miss this earlier,
We can not use addMonths() method in Visualforce.
All Answers
Try this. :)
value="{!If(Account.LatestCompaintDate__c = System.now().addMonths(-6), $Resource.xxx,'')}"
Just chnged to singlequotes in if method.
sorry i changed to single quotes and i still get the error!
james, yes sorry typing error i am acutally using <=
thanks
System.now() is a method defined in Apex, but it doesn't translate to Visualforce's NOW() function well. See more on the NOW() Visualforce function here: https://www.salesforce.com/us/developer/docs/pages/Content/pages_variables_functions.htm
Your next best bet is to create a variable in your Apex class / controller that does the Date calculation, and then display that variable in your value attribute above.
Sorry I miss this earlier,
We can not use addMonths() method in Visualforce.