We have a managed package. Is it possible to use Salesforce DX to write triggers and classes using objects provided by the managed package?

When creating a scratch org, there is nothing associated with the managed package in there so how can you develop code against objects that are part of the managed package?

Thank you

1 Answer 1


Yes, this is possible.

Create a scratch org, and install your managed package

sfdx force:package:install -i 04t... --targetusername [email protected] Link

where -i 04t... is the package Id which you will find on any installation link of your package.

As with ordinary orgs, you will have to use the namespace for all your packaged objects.

E.g. [Select id FROM myNamespace__MyCustomObject__c]

It is also possible to create a scratch org with your myNamespace.

  • Excellent, thank you! Does this work for Paid managed packages?
    – realtek
    Jan 24, 2018 at 11:46
  • Not sure I understand the question or its intention but from a technical standpoint, there's no difference between a managed paid or manageded free package. Jan 25, 2018 at 12:07

You must log in to answer this question.

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