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
Laurent Poulain 14Laurent Poulain 14 

Create custom object using Apex Metadata API

Hello,

Is it possible to create a custom object using Apex Metadata API? I wasn't able to find any code example about this quite recent API.

Note that I am creating it right now by making a callout to the Metadata API, but am wondering if there is a better way.

Thanks,
Laurent
PriyaPriya (Salesforce Developers) 

Hey Laurent,

Yes it is possible to create the custom object using Metadata API.

Refer this link ;- https://developer.salesforce.com/forums/?id=906F0000000AhDtIAK

If it helps, kindly mark it as the best answer.

Regards,

Priya Ranjan

Laurent Poulain 14Laurent Poulain 14
Hi Priya,

This is using the callout to the Metadata API, which I am already using. I'm looking for a way to use the new Apex Metadata API.

Regards,
Laurent
Maciej Król 28Maciej Król 28
I can't find apropriate class in Metadata Namespace (https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_namespace_Metadata.htm) so I'd assume it's not achievable so far.