You need to sign in to do that
Don't have an account?
SFDX Push Error: An object 'Account.ParentId' of type CustomField was named in package.xml, but was not found in zipped directory
Hello,
I created a scratch orgs without problems and now I am trying to push the source from the local branch.
I am getting 68 errors of this type:
Could anyone help me understand what I'm doing wrong, please?
Many thanks!
Sabina
I created a scratch orgs without problems and now I am trying to push the source from the local branch.
I am getting 68 errors of this type:
An object 'Account.ParentId' of type CustomField was named in package.xml, but was not found in zipped directoryAll the mentioned fields are in the sfdx project source under main/default/objects/Account/fields and the scratch org API version matches the project one.
Could anyone help me understand what I'm doing wrong, please?
Many thanks!
Sabina
This is currently a limitation of the packaging framework and the metadata API. The same object cannot be referenced in multiple packageDirectories
I use the sfdx-falcon template (https://github.com/sfdx-isv/sfdx-falcon-template/tree/master/sfdx-source) with separate folders for the packaged components (part of our AppExchange app) and unpackaged components (configuration used for testing and quick org setup). And I had the Account and Contact objects split in the two folders as follows:
/namespace
--/Account
----/fields
------ (all the fields that we package)
/unpackaged
--/Account
----/fields
------ (all the other fields)
And this caused the failure. Once I removed the /fields, /listviews, and other folders from unpackaged > Account, the push worked.
I could still keep the Account.object-meta.xml file in unpackaged > Account and the rest in namespace > Account. This helps us set default Account record pages when creating scratch orgs, instead of having to manually drag the components onto the page every time.
I hope this helps.
All Answers
Did you get the reolution for this? I am also facing similar issue and not sure if it is able to identify package.xml path.
Thanks!
To fix the above issue, check if the xml file name is matching the api file name. For example
If Phone is the custom field as below.
We need to make sure, the xml file name is as below:
Phone.field-meta.xml.
It goes for all the custom fields API name and their meta.xml files.
Hope this helps.
Regards,
Ankush
I keep getting these errors unfortunately. I checked, and we have all the needed XML files. But it still doesn't work.
I have already opened my third case on the topic with Salesforce. But they keep closing them :)
Will keep this thread updated if I get any useful information.
Thanks,
Sabina
Hi Sabina,
Any chance you've heard back on your case? (or figured out the problem?) I'm getting the same errors and also opened a case but haven't heard anything yet.
Thank you,
Kim
This is currently a limitation of the packaging framework and the metadata API. The same object cannot be referenced in multiple packageDirectories
I use the sfdx-falcon template (https://github.com/sfdx-isv/sfdx-falcon-template/tree/master/sfdx-source) with separate folders for the packaged components (part of our AppExchange app) and unpackaged components (configuration used for testing and quick org setup). And I had the Account and Contact objects split in the two folders as follows:
/namespace
--/Account
----/fields
------ (all the fields that we package)
/unpackaged
--/Account
----/fields
------ (all the other fields)
And this caused the failure. Once I removed the /fields, /listviews, and other folders from unpackaged > Account, the push worked.
I could still keep the Account.object-meta.xml file in unpackaged > Account and the rest in namespace > Account. This helps us set default Account record pages when creating scratch orgs, instead of having to manually drag the components onto the page every time.
I hope this helps.
Fb Status hindi-----Whatsaap Status -----Attitude-status---------Gf-Bf Status -----Royal Status
I had the same issue. The problem is having a Custom Object with the same name as a Custom Field that belongs to it.
Before pushing, check the Folder of the Custom Object, and make sure it contains only 1 File with the name (having .object).
I had 1 file with .object, and 1 file .field .
Once I deleted the .field from the Folder (careful, from the Custom Object folder, and not the fields folder) the push worked well.
Goodluck
After "deleting" the metadata XML config files that were in the correct folder and inadvertently leaving the files created by the bug, I started getting this message. Eventually figured it out and removed those files as well which fixed the problem and my source pushed. Hopefully this is helpful in case someone else is in this boat while building a 2nd gen package.
Hello Friends...i have a below issue while deploying a new Apex xlass tbrough Jenkins fom git branch...
While deploying one apex class through Jenkins..i am getting the below error. Details are mentioned as below.
API Name
ChandraApexClass
Error Message
An object 'ChandraApexClass' of type ApexClass was named in package.xml, but was not found in zipped directory
package.xml
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
<types>
<members>ChandraApexClass</members>
<name>ApexClass</name>
</types>
<version>51.0</version>
</Package>
Apex Class Name:-
ChandraApexClass.cls
Apex Class:-
public with sharing class ChandraApexClass {
public static void ApexClassDebug() {
List<Contact> contList = [Select Id, Name from Contact Limit 50];
for(Contact conts : contList)
{
System.Debug('Contact Name' + conts.Name);
//Test
System.Debug('Just To Test');
}
}
}
I was facing similar issue like this.
The problem is that SFDX follows a folder structure. If you or anyone have pushed a file incorrectly , we get this error.
Solution: 1. Search with the file name in any file explorer/VS Code project and see the directory it is in.
2. Most definitely the file is not in the correct folder Ex- a field should be inside object/Object_name/fields/fieldname.field-meta.xml but mostly you might have pushed it incorrectly.
3. Move the file in correct folder and push your code in repo/ git.
4. Re-run your deployment.
Voila! your error is gone :)
Lets consider one new apex classes you are moving but somehow it logged to APEXPAGES section in package xml file then you may come across with this type of errors while validatiing & deploymnets