function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
canonwcanonw 

No SOQL or DML in Custom Component?

I read Visualforce Developer's Guide for Spring 08. 

It documents Custom Component does not allow executing SOQL or SOQL queries or DML operations. 

Is that remains the case for Summer 08?

Thanks in advance.
mtbclimbermtbclimber
No longer the case. (Throw away that old reference ;-) )

You can perform SOQL (and SOSL) from custom component controllers. DML can be enabled if you set the appropriate flag on the component tag.  You need to be very careful and explicit about any DML that you do in your component since your consumer may be presenting the same information you are operating on in other areas of their page and you can cause side effect and collision issues if you do not communicate the scope of your DML operations to your consumer.  It's also a good idea to surface a rerender pass-through attribute so your consumer can hook into any action your component takes.  Alternatively, you can also allow your consumer to pass an action to you using an attribute with type="ApexPages.Action"  That way you can delegate to the consumer's defined action.