8

We are trying to start using custom labels, but are having issues deploying them using our ant script.

Our custom labels file looks something like this:

<?xml version="1.0" encoding="UTF-8"?> 
<CustomLabels xmlns="http://soap.sforce.com/2006/04/metadata">
     <labels>
         <fullName>Inspection_Name</fullName>
         <language>en_US</language>
         <protected>true</protected>
         <shortDescription>Inspection Name</shortDescription>
         <value>Inspection</value>
     </labels>
</CustomLabels>

In the package.xml we have added this:

<types>
    <members>*</members>
    <name>CustomLabels</name>
</types>

We are getting the following error when deploying:

Error: labels/CustomLabels.labels(Inspection_Name):Not in package.xml

Ant command (variables come from a properties file):

<sf:deploy 
   username="${sf.username}" 
   password="${sf.password}${sf.token}" 
   serverurl="https://login.salesforce.com" 
   deployRoot="${target.dir}" 
   maxPoll="500" 
   pollWaitMillis="20000"
   runAllTests="true" 
   logType="Debugonly" 
/>

The package.xml and migration toolkit are both at API 27.0. What are we missing?

  • The first few lines of your XML are incorrect. Is that just a typo? You have the xmlns declaration running on in an un-opened tag after CustomLabels. – Mike Chale May 30 '13 at 18:56
  • Yep. Sorry, typo. Edited original post. – Rob Scott May 30 '13 at 19:07
  • Those files look fine to me, what is the ANT command and have you ensured that the customLabels file is actually present in the subdirectory /labels of the directory you have in the script? You will get that error if the filepath is wrong. – Doug B May 30 '13 at 19:21
  • Updated post with Ant command. The "target.dir" folder does contain the CustomLabels.labels file in the "labels" directory. This works (and has been working) with every file type except custom labels. – Rob Scott May 30 '13 at 20:06
  • Clutching at straws a bit here, but could it be because the label is <protected>? Labels I've deployed before have always had this attribute set to false. Not sure if this should make a difference though. – Doug B May 31 '13 at 10:17
13

I got the same error and tried the code below. It worked. The metadata type is CustomLabel not CustomLabels. It's very strange.

<types>
    <members>*</members>
    <name>CustomLabel</name>
</types>

Reference:
Salesforce Metadata Types

  • This works. I guess it's not terribly strange seeing that every other metadata type is also singular. It is unique though in that there is only a single file with a plural name and a plural file extension. A touch confusing. – Rob Scott Nov 5 '13 at 22:38
0

Are you sure that the package.xml in "${target.dir}/src" does indeed contain:

<types>
    <members>*</members>
    <name>CustomLabels</name>
</types>

The error message like this

Error: labels/CustomLabels.labels(Inspection_Name):Not in package.xml

usually means that the package.xml file in your ${target.dir}/src" does not have labels definition. I.e. target dir contains more subfolders/types than specified in the package.xml. Every file in the deployRoot must be in package.xml.

  • The package.xml file being used definitely has the labels definition. – Rob Scott May 31 '13 at 16:21
  • Everything looks fine with your xml and ant. Try doing a refresh to see if the Custom Labels can be pulled down from an org or use the Force.com IDE rather than ANT. I've found that I sometimes get more meaningful errors using the IDE – BarCotter Oct 17 '13 at 10:33

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.