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
vineet kumarvineet kumar 

Somebody Pls Let me know how to create custom object using metadata api (pls provide code not links)!!!

Try this:
CustomObject co = new CustomObject();
String name = "MyNewObj";
co.setFullName(name + "__c");
co.setDescription("Created by the Metadata API");
co.setLabel(name + " Object");
co.setPluralLabel(co.getLabel() + "s");
CustomField nf = new CustomField();
nf.setLabel(co.getFullName() + " Name");
vineet kumarvineet kumar

I'm getting this error
Invalid type: CustomObject
Raj VakatiRaj Vakati
MetadataService.CustomObject customObject = new MetadataService.CustomObject();
customObject.fullName = ‘Test__c’;
customObject.label = ‘Test’;
customObject.pluralLabel = ‘Tests’;
customObject.nameField = new MetadataService.CustomField();
customObject.nameField.type_x = ‘Text’;
customObject.nameField.label = ‘Test Record’;
customObject.deploymentStatus = ‘Deployed’;
customObject.sharingModel = ‘ReadWrite’;
MetadataService.AsyncResult[] results = service.create(new List<MetadataService.Metadata> { customObject });

vineet kumarvineet kumar
 @Raj vakati

I'm getting this error
Invalid type: MetadataService.CustomObject