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
varaprasad vvaraprasad v 

In Constructor we will use SOQL or NOT

Hi Everyone,

I have small doubt.

In Constructor we will use SOQL or NOT ?

Thanks to Advance.
Anoop yadavAnoop yadav
yes, you can use.
Vijay NagarathinamVijay Nagarathinam

yes you can use the SOQL query inside your constructor. But Its not an best practice in salesforce. Because when the class is excute first the  constructor will call so that time the query will be execute.
Prateek Tandon 4Prateek Tandon 4

You can use SOQL in constructor. But you cannot perform any DML operations in constructor.
varaprasad vvaraprasad v
Thanks to Every one