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


Yes, this is possible.

Create a scratch org, and install your managed package

sfdx force:package:install -i 04t... --targetusername jdoe@example.com 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 '18 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 '18 at 12:07

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.