0

I'm creating a new managed package and I'm unsure of how to add a custom object to the package. In 1GP I would create a new object in the org as normal and then retrieve source from org to pull through the new objects.

With 2GP I'm not necessarily attached to an org for development so I'm unsure on how to create an object for my package. Is it as simple as just creating the object-meta.xml files manually? Will I need to create a package.xml file as well? When I try to create the object-meta.xml file manually in VSCode I'm getting the following error:

cvc-elt.1.a: Cannot find the declaration of element 'CustomObject'.xml(cvc-elt.1.a)

Is this something that will be breaking for the package or just something VSCode doesn't understand.

1 Answer 1

0

cvc-elt.1.a: Cannot find the declaration of element 'CustomObject'.xml(cvc-elt.1.a)

That's just the standard XML validator complaining about a non-existent schema. It won't prevent deployments or package creation.

With 2GP I'm not necessarily attached to an org for development so I'm unsure on how to create an object for my package.

Most developers use either Scratch Orgs or Sandbox Orgs, so you should always have an available environment attached. Just because the repo is the new "source of truth" doesn't mean you shouldn't leverage orgs for development.

Is it as simple as just creating the object-meta.xml files manually?

You can, although I find it tedious. Just create a new org, deploy any source you want, use the UI to create your object, and finally use project retrieve to get the new metadata.

Will I need to create a package.xml file as well?

No. Source format automatically takes care of the details for you.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .