-1

can I put into a outputfield a formula like below?

IF Today - LastModifiedDate > 60 , RED , IF Today - LastModifiedDate > 30 , YELLOW, ELSE GREEN

Thanks, Sascha

<apex:outputField value="{IF{!AccOpp.LastModifiedDate}-{!Today}>60,'RED'I{IF{!AccOpp.LastModifiedDate}-{!Today}>30,'YELLOW','GREEN'}" />

1 Answer 1

4

No. The value attribute on an apex:outputField has to be an SObject field. If you want to display text then you can use apex:outputText

Your formula doesn't look correct. I believe it should be something like this:

{!IF((TODAY() - DATEVALUE(AccOpp.LastModifiedDate)) > 60, 
     "RED", 
      IF((TODAY() - DATEVALUE(AccOpp.LastModifiedDate)) > 30, 
          "YELLOW", 
          "Green"))
}
3
  • 1
    The LastModifiedDate needs an additional function. <apex:outputText value="{!IF((Today() - DATEVALUE(AccOpp.LastModifiedDate)) > 60, "RED", IF((Today() - DATEVALUE(AccOpp.LastModifiedDate)) > 30, "YELLOW", "GREEN"))}" /> It works, Thanks.
    – peXeq
    Commented Jun 19, 2015 at 18:46
  • I tried to change the words into an image, but I get an error Function IMAGE may not be used in this type of formula. {!IF((Today() - DATEVALUE(AccOpp.LastModifiedDate)) > 60, IMAGE("/servlet/servlet.FileDownload?file=/015b0000001EJIK"), IF((Today() - DATEVALUE(AccOpp.LastModifiedDate)) > 30, IMAGE("/servlet/servlet.FileDownload?file=/015b0000001EJLH"), IMAGE("/servlet/servlet.FileDownload?file=/015b0000001EJJAE")))} Any ideas?
    – peXeq
    Commented Jun 19, 2015 at 19:22
  • Your field type is probably not compatible with an image, e.g. its of type Text. I imagine that Text Area (Rich) would be the only valid field type.
    – BarCotter
    Commented Jun 22, 2015 at 9:27

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .