You need to sign in to do that
Don't have an account?
Emanuela
Must specify a nameField of type Text or AutoNumber
Hi everyone,
I'm trying to create a custom object with 3 custom fields but salesforce returns the exception below :
AxisFault
faultCode: {http://soap.sforce.com/2006/04/metadata}UNKNOWN_EXCEPTION
faultSubcode:
faultString: null: Must specify a nameField of type Text or AutoNumber
here the code :
What's the problem?
Cheers
Emanuela
I'm trying to create a custom object with 3 custom fields but salesforce returns the exception below :
AxisFault
faultCode: {http://soap.sforce.com/2006/04/metadata}UNKNOWN_EXCEPTION
faultSubcode:
faultString: null: Must specify a nameField of type Text or AutoNumber
here the code :
Code:
CustomObject co = new CustomObject(); String name = "SFTestObject"; 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() + "TEST1"); CustomField nf1 = new CustomField(); nf1.setType(FieldType.Text); nf1.setLabel(co.getFullName() + "TEST2"); CustomField nf2 = new CustomField(); nf2.setType(FieldType.Text); nf2.setLabel(co.getFullName() + "TEST3"); CustomField[] fieldsArray = new CustomField[]{nf, nf1, nf2}; co.setFields(fieldsArray); AsyncResult[] ars = metaBinding.create(new Metadata[] { co} );
Cheers
Emanuela
I've resolved.
Before you create the custom fields you have to create the custom object.
Bye!
I've tried for the issue but still geting the same error.
So can you share your code which may help me to resolve my issue.
Thanks