You need to sign in to do that
Don't have an account?
Jester
DML in Controller Constructor?
Hi,
When I try to perform DML (a simple update) in my controller constructor I get an error. Why is this not allowed? Is there any way to perform such an update?
I am aware of the action parameter in the page tag. That is not sufficient for me as I am working under an interesting constraint, which unfortunately means no javascript. (Or at least the type that calls back to the controller).
Thanks!
When I try to perform DML (a simple update) in my controller constructor I get an error. Why is this not allowed? Is there any way to perform such an update?
I am aware of the action parameter in the page tag. That is not sufficient for me as I am working under an interesting constraint, which unfortunately means no javascript. (Or at least the type that calls back to the controller).
Thanks!
All Answers
That makes sense... I ran into the same problem and assumed that 'action' wouldn't allow DML either on the record (or records if list controller) being loaded... but because action runs before the constructor it works. Thanks!
Additional thought: Between the 'action' and 'rendered' properties, pages can be extremely flexible and dynamic... good stuff.