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
mkr mkrmkr mkr 

when a trigger fire can we create a new field? like if we create a trigger on account a filed create automaticaly

so_mayankso_mayank
hi mkr mkr,

I think you are referring to using Metadata API from Apex. Currently, it is not possible from standard Salesforce. However, there is an Apex Wrapper written for it. Take a look at this https://github.com/financialforcedev/apex-mdapi.

Please mark this answer as best, if it resolved your query.
SandhyaSandhya (Salesforce Developers) 
Hi,

You can do that by using the metadata API and a web service.Refer below links.

https://developer.salesforce.com/forums?id=906F00000008z8gIAA
 
https://github.com/financialforcedev/apex-mdapi/tree/master/apex-mdapi/src/classes
 
Please mark it as solved if my reply was helpful. It will make it available for other as the proper solution.
                                             
Best Regards
Sandhya
 
 
mkr mkrmkr mkr
sorry i want just from trigger only can it possible?
there may be other chance through mata data or page layout any thing but i want it from trigger
so_mayankso_mayank
The trigger will execute Apex code, right.

Here you can use the Metadata Wrapper I mentioned to write code that would create the field on the object.