Don't have an account?
Search for an answer or ask a question of the zone or Customer Support.
You need to sign in to do that
Sign in to start searching questions
Signup for a Developer Edition
Sign in to start a discussion
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 });
CustomObject co = new CustomObject();
String name = "MyNewObj";
co.setFullName(name + "__c");
co.setDeploymentStatus(DeploymentStatus.Deployed);
co.setDescription("Created by the Metadata API");
co.setEnableActivities(true);
co.setLabel(name + " Object");
co.setPluralLabel(co.getLabel() + "s");
co.setSharingModel(SharingModel.ReadWrite);
CustomField nf = new CustomField();
nf.setType(FieldType.Text);
nf.setLabel(co.getFullName() + " Name");
co.setNameField(nf);
I'm getting this error
Invalid type: CustomObject
I'm getting this error
Invalid type: MetadataService.CustomObject