1

I'm updating MetadataService.cls form a older version for v29 to the current version v32 and found some members maybe missing:

  • MetadataPort.checkStatus(String[] asyncProcessId)
  • MetadataPort.checkDeployStatus(String asyncProcessId)
  • MetadataService.checkStatus_element
  • checkStatusResponse_element

In the earlier version the use case (which now results in an error ) was to e.g. retrieve metadata like this

public PageReference checkAsyncRequestRetrieve()    {
    errors = 0;
 // Check the status of the retrieve request
    MetadataService.MetadataPort
        service                         = createService(); 
    MetadataService.AsyncResult[]
        aysncResults                    = service.checkStatus(new String[] { AsyncResultRetrieve.Id });
    if(aysncResults[0].done) {
        if(aysncResults[0].state == 'Error') {      // async errors:
            ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.Info, aysncResults[0].message));
            AsyncResultRetrieve = null;
        } else {                                    // async no errors:
            MetadataService.RetrieveResult          // Place Base64 encoded zip data onto the page for the JSZip library to handle
                retrieveResult          = service.checkRetrieveStatus(AsyncResultRetrieve.id);
            if(retrieveResult.messages != null) { 
                xt.msg('Error '+retrieveResult.messages[0].problem ,'error');
                errors = 1;
            } else {
                xt.msg('Retrieved '+MetaDataItem,'confirm');
            }
            MetaDataRetrieveZip         = retrieveResult.zipFile;
            MetadataFiles               = new List<MetadataFile>();
            AsyncResultRetrieve         = null;
            Retrieving                  = false;
        }
    }
    return null;
}

However I found that all works like before by simply copying those members back to the new MetadataService.cls for v32

public class MetadataPort { // around line 9120
// ....

public MetadataService.AsyncResult[] checkStatus(String[] asyncProcessId) {
        MetadataService.checkStatus_element request_x = new MetadataService.checkStatus_element();
        MetadataService.checkStatusResponse_element response_x;
        request_x.asyncProcessId = asyncProcessId;
        Map<String, MetadataService.checkStatusResponse_element> response_map_x = new Map<String, MetadataService.checkStatusResponse_element>();
        response_map_x.put('response_x', response_x);
        WebServiceCallout.invoke(
              this,
              request_x,
              response_map_x,
              new String[]{endpoint_x,
              '',
              'http://soap.sforce.com/2006/04/metadata',
              'checkStatus',
              'http://soap.sforce.com/2006/04/metadata',
              'checkStatusResponse',
              'MetadataService.checkStatusResponse_element'}
        );
        response_x = response_map_x.get('response_x');
        return response_x.result;
    }

    public MetadataService.DeployResult checkDeployStatus(String asyncProcessId) {
        MetadataService.checkDeployStatus_element request_x = new MetadataService.checkDeployStatus_element();
        MetadataService.checkDeployStatusResponse_element response_x;
            request_x.asyncProcessId = asyncProcessId;
            request_x.includeDetails = true;

        Map<String, MetadataService.checkDeployStatusResponse_element> response_map_x = new Map<String, MetadataService.checkDeployStatusResponse_element>();
        response_map_x.put('response_x', response_x);
        WebServiceCallout.invoke(
              this,
              request_x,
              response_map_x,
              new String[]{endpoint_x,
              '',
              'http://soap.sforce.com/2006/04/metadata',
              'checkDeployStatus',
              'http://soap.sforce.com/2006/04/metadata',
              'checkDeployStatusResponse',
              'MetadataService.checkDeployStatusResponse_element'}
        );
        response_x = response_map_x.get('response_x');
        return response_x.result;
    }
// ...
}

and also

public class MetadataService {

public class checkStatus_element {
    public String[] asyncProcessId;
    private String[] asyncProcessId_type_info = new String[]{'asyncProcessId','http://soap.sforce.com/2006/04/metadata','ID','0','-1','false'};
    private String[] apex_schema_type_info = new String[]{'http://soap.sforce.com/2006/04/metadata','true','false'};
    private String[] field_order_type_info = new String[]{'asyncProcessId'};
}

public class checkStatusResponse_element {
    public MetadataService.AsyncResult[] result;
    private String[] result_type_info = new String[]{'result','http://soap.sforce.com/2006/04/metadata','AsyncResult','0','-1','false'};
    private String[] apex_schema_type_info = new String[]{'http://soap.sforce.com/2006/04/metadata','true','false'};
    private String[] field_order_type_info = new String[]{'result'};
}

}

So my questions are:

  • are those members being removed on purpose or are the simply missing?
    • UPDATE: this answered by @gaiser
  • if they are removed on purpose, is there now a new pattern to handle the retrieve and deploy as described in the use case above?
2

Metadata checkStatus(ID[] ids) call have been removed starting API v31.0
You now have to use checkDeployStatus(ID id, includeDetails boolean) or checkRetrieveStatus(ID id) depending on whether you called deploy() or retrieve() https://www.salesforce.com/us/developer/docs/api_meta/Content/meta_checkstatus.htm

Starting in API version 29.0, you no longer have to call checkStatus() after a deploy() call to get information about deployments. Similarly, starting in API version 31.0, you no longer have to call checkStatus() after a retrieve() call. The checkStatus() call has been replaced by checkDeployStatus() and checkRetrieveStatus() for deploy and retrieve operations respectively.

  • As for v32.0 however it seems that you have tho choice to go on with the legacy pattern as I did by including those older members back into MetadataService.cls – Uwe Heim Nov 30 '14 at 12:45
  • That is correct. The checkStatus has been deprecated but not removed from the API. The checkStatus(String, boolean) gives you the choice to request the details of the deployment process (what is being deployed, what are the current set of errors etc.). Small change but big impact. – Sridhar Nov 30 '14 at 21:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.