You need to sign in to do that
Don't have an account?
Vasavi Vajinepalli
URGENT: How to create custom objects and custom fields dynamically through Java or Apex
Hi,
Can anyone please suggest me how to create custom objects and custom fields dynamically through Java or apex code.
If it is through Java, please suggest me the supported Jars as well. Appreciate if you can share the code for the same.
Thanks,
Vasavi
Can anyone please suggest me how to create custom objects and custom fields dynamically through Java or apex code.
If it is through Java, please suggest me the supported Jars as well. Appreciate if you can share the code for the same.
Thanks,
Vasavi
So here is a link to the Metadata API create() function: https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_create.htm
And there are examples here of how to use that to send the definition of a new object (using Apex):
https://github.com/financialforcedev/apex-mdapi/blob/master/apex-mdapi/src/classes/MetadataServiceExamples.cls#L35
You should be able to take that example and just fire an object into an Org if you want.. hopefully that will get you going? All you have to do then is copy and paste the code a bunch of times to insert the objects and fields you desire!
You can do with metadata API.
Thanka!
For creating Object and field using apex code firstly you have to insert MetadataService controller and MetadataService Test controller
in your organization.
If you find your Solution then mark this as the best answer.
Thank you!
Regards,
Suraj Tripathi