0

I've been banging my head against a wall for this and can't seem to figure out this error. VF seems to be reading my field as an object.

Here is my code

LineitemNumber: <apex:outputText value="{!(NOW()-object.LastModifiedDate)*24*60*60}"></apex:outputText>

Here is the error: "Error: Incorrect parameter type for operator '-'. Expected Number, Date, DateTime, received Object"

How is VF reading the field as an object?

7
  • Did you literally name your variable "Object"?
    – sfdcfox
    Jul 21, 2016 at 22:54
  • I am not, I'm getting it from a controller. from my controller, it is called lineItems. What is weird is that I tested it with another object that I pull LastModifiedDate from and it works just fine. It just won't read with this object.
    – Andrew
    Jul 21, 2016 at 22:59
  • I found something similar in this link, except it is with a different error: salesforce.stackexchange.com/questions/9482/…
    – Andrew
    Jul 21, 2016 at 23:02
  • What's the data type of LineItems? It sounds like a List...
    – sfdcfox
    Jul 21, 2016 at 23:03
  • Maybe that is what I am not understanding. LineItems is the object but when I think datatype, I'm thinking LastModifiedDate is the field with datatype of DateTime.
    – Andrew
    Jul 21, 2016 at 23:10

1 Answer 1

2

This code works in my org:

<apex:page standardController="Account">
    {!(NOW()-Account.LastModifiedDate)*86400}
</apex:page>

(It also works with apex:outputText).

Check the data type of the variable you're referencing, and make sure you're referencing the correct variable.

You must log in to answer this question.

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