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.
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.
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
there may be other chance through mata data or page layout any thing but i want it from trigger
Here you can use the Metadata Wrapper I mentioned to write code that would create the field on the object.