+ Start a Discussion
College ManagementCollege Management 

(Tooling Api) Can i create custom field on ApexClass object ?

Thanks !
logontokartiklogontokartik
Nope. You cannot.
Vinit_KumarVinit_Kumar
In short No, you can't create custom fields via Apex as they are Metadata.

However ,there is a workaround which was created by @Andy.You might want to look at below :-

https://github.com/financialforcedev/apex-mdapi

Also,the below post has replies which would inform how you can use the github package.

https://developer.salesforce.com/forums?id=906F00000008z8gIAA

Hope this helps !!
College ManagementCollege Management
Thanks for the response ,and  Yes we can create custom fields via Apex code , But I am not asking about creation of fields via Apex code, My question is about ApexClass Tooling Api Sobject , How can i create a field for ApexClass object ?? 
Please look into the link http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_objects_apexclass.htm

Thanks !
Vinit_KumarVinit_Kumar
Ohk so you want to create a field on ApexClass object,I am afraid you can't add a new feild here.

However,I would like to understand what is the use case here and why you want to add a field to ApexClass object ??
College ManagementCollege Management
@Vinit, If u open detail page of any apex class you will see the below image User-added image

Can u see tabs like Class body , Class summary, Version settings & Log filters ?? I want to add a custom field beside those existing tabs . If anyone know that we can achieve it , please help me out.

Thanks !
Vinit_KumarVinit_Kumar
As far as I know,this is not possible as of, now !!
College ManagementCollege Management
Anyway thanks for the information. If it is possible please let me know.