DID THIS ARTICLE SOLVE YOUR ISSUE?
Let us know so we can improve!
Let us know so we can improve!
delete()Deprecated. Deletes one or more components from your organization asynchronously. This call is removed as of API version 31.0 and is available in earlier versions only. Use deleteMetadata() instead.
You can use this call to delete any of the objects that extend Metadata. For more details, see Metadata Components and Types.
1AsyncResult[] = metadataConnection.delete(Metadata[] metadata);Use this call to delete one or more components from your organization.
This call is available in API version 30.0 and earlier only. This call isn’t available in API version 31.0 and later. Use deleteMetadata() instead.
Your client application must be logged in with the Modify Metadata Through Metadata API Functions or Modify All Data permission.
If a user requires access to metadata but not to data, enable the Modify Metadata Through Metadata API Functions permission. Otherwise, enable the Modify All Data permission.
Note
When deleting components, consider the following rules and guidelines:
Use the following process to delete metadata components:
delete() call, passing in the array of metadata components with fullName specified.1public void deleteCustomObject() {
2 try {
3 CustomObject co = new CustomObject();
4 co.setFullName("MyCustomObject__c");
5 AsyncResult[] ars = metadataConnection.create(new Metadata[]
6 {co});
7 AsyncResult asyncResult = ars[0];
8 long waitTimeMilliSecs = 1000;
9 while (!asyncResult.isDone()) {
10 Thread.sleep(waitTimeMilliSecs);
11 // double the wait time for the next iteration
12 waitTimeMilliSecs *= 2;
13 asyncResult = mdConnection.checkStatus(
14 new String[] {asyncResult.getId()})[0];
15 System.out.println("Status is: " + asyncResult.getState());
16 }
17 } catch (ConnectionException ce) {
18 ce.printStackTrace();
19 } catch (InterruptedException ie) {
20 ie.printStackTrace();
21 }
22}Type: Metadata[]
Description: Array of one or more metadata components. Only set the fullName field in the Metadata object.
Limit: 10.
You must submit arrays of only one type of component. For example, you could submit an array of 10 custom objects or 10 profiles, but not a mix of both types.