• Carledriss
  • NEWBIE
  • 0 Points
  • Member since 2013

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 0
    Replies

Hi,

 

I am using Metada API to delete custom fields.

I can delete custom field of an Object, but the custom field is put in the 'Deleted Fields' with the following API name customfield_del__c

Is it possible to erase the custom field of the 'Deleted Fields' list? I need to delete them of that list as well

 

I am using the following code

 

    public static void deleteCustomField(String fullname) throws Exception 
    {
        CustomField customField = new CustomField();
        customField.setFullName(fullname);
        UpdateMetadata updateMetadata = new UpdateMetadata();
        updateMetadata.setMetadata(customField);
        updateMetadata.setCurrentName(fullname);
        
        AsyncResult[] asyncResults  = metadataConnection.delete(new Metadata[] {customField});
 
        long waitTimeMilliSecs = ONE_SECOND;
 
        do 
        {
            printAsyncResultStatus(asyncResults);
            waitTimeMilliSecs *= 2;
            Thread.sleep(waitTimeMilliSecs);
            asyncResults = metadataConnection.checkStatus(new String[]{asyncResults[0].getId()});
        } while (!asyncResults[0].isDone());
 
        printAsyncResultStatus(asyncResults);
    }