0

I want to set the background color for one column if the "Due Date" is older than today. I can't quite figure out the correct syntax for the variable that holds the date value for today.

I am currently getting this error: Incorrect parameter type for function 'not()'. Expected Boolean, received Date

VisualForce Page Snip:

                <apex:column style="{!if(acc.Due_Date__c <= !dToday,'background:#BDB76B;', '')}">
                    <apex:facet name="header">
                        Due Date
                    </apex:facet>
                    <apex:outputField value="{!Acc.Due_Date__c}" />
                </apex:column>

Controller Snip:

public class controller_AccountServicing {
    //Create Variables
    list    <Account_Servicing_Activity__c> accActivities   = new list<Account_Servicing_Activity__c>();
    public  boolean renderPrompt    {get;set;}
    public  Id      accId           {get;set;}
    public  String  accStatus       {get;set;}
    public  String  accExReason     {get;set;}
    public  Date    dToday          {get;set;}
    Account_Servicing_Activity__c   accToUpdate;

    public controller_AccountServicing(){
        //Initilization items
        Id currentuser = system.UserInfo.getUserId();
        dtoday = system.today();
    }
3

I think you want to change this line

{!if(acc.Due_Date__c <= !dToday,'background:#BDB76B;', '')}

To

{!if(acc.Due_Date__c <= dToday,'background:#BDB76B;', '')}
| improve this answer | |
  • @MattM - Could also use TODAY() in lieu of dToday in the VF expression – cropredy Mar 28 '18 at 19:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.