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
Srinivas AnnamSrinivas Annam 

How do you add field to custom object through soql query?

J CesarJ Cesar
You mean to reference a field or to populate a field?

You don't add fields to objects through code, you need to do it from the user interface.
DeepthiDeepthi (Salesforce Developers) 
Hi Srinivas,

You cannot add fields to object through SOQL query. It only fetches the records from your model to display in any of your view screens.

Best Regards,
Deepthi