Whenever I create a formula field in an object and try to select that, the formula/trigger has an error and says that the field does not exist. From what I understand, it should work especially that i checked "This field can be used as a merge field in templates and formulas"
Hi Akira,
This is correct behavior but we should do a better job clarifying this in the query API documentation.
Formula and Template fields cannot be queried with the query API because they do not actually correspond to columns in the database, rather these fields are computed on the fly. In other words, there is nothing to query -- you can only query stored fields, not dynamically computed fields.
Thanks,
Matt
ok... thanks!
No problem. If you really need this kind of behavior you can use a trigger to write the value of your formula to a text field and then use the query api to work with that field.
Please refer to Chapter 6 of documentations for details - this is explained there.