function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
SurekaSureka 

Web service callout failed: WebService returned a SOAP Fault: INVALID_TYPE: Cannot use: CustomLabel in this version faultcode=sf:INVALID_TYPE faultactor= Error

Hi,

I am trying to query CustomLabels using Metadata API. I am using the following code: 

MetadataService.MetadataPort service = createService();            
            List<
MetadataService.ListMetadataQuery> queries = new List<MetadataService.ListMetadataQuery>();       
            
MetadataService.ListMetadataQuery queryLayout = new MetadataService.ListMetadataQuery();
            queryLayout.type_x = 'CustomLabel';
            queries.add(queryLayout);      
            
MetadataService.FileProperties[] fileProperties = service.listMetadata(queries, 10);

The above code is giving the following exception:

Web service callout failed: WebService returned a SOAP Fault: INVALID_TYPE: Cannot use: CustomLabel in this version faultcode=sf:INVALID_TYPE faultactor=  Error

In the documentation it is mentioned that we can query the custom label. Please let me know if there is something wrong in the above code.

Thanks
James LoghryJames Loghry
Sureka,

I cannot find when support for CustomLabels was added to Salesforce's metadata api.  Have you upgraded all of your classes to the latest version of Salesforce?  Before moving any further I would make sure to update all your related classes to the latest api Version, which would be 30.0 or 31.0 depending on whether your pod has been upgraded to Summer '14 yet.  

If that doesn't work, dig through the metadata api documentation here: https://www.salesforce.com/us/developer/docs/api_meta/ 

Or, it sounds like this also may be a question for the author of the apex-mdapi project on github (https://github.com/financialforcedev/apex-mdapi).  If you think that's the case, then I would open a github issue.