Install Manage Package in Scratch Org using Salesforce DX

Install Manage Package using SFDX in Scratch Org

There are tons of useful SFDX commands available to help automate Salesforce deployment. However one of most important aspect of Salesforce DX is capability of spinning org within few minutes with features enabled like Person Account, Communities etc.

There could be times, where these commands might not be sufficient. I recently cam across such scenario where I wanted to install manage package for quick capability check.

Scanned through documentation, Stack Exchange and spent lots of time figuring out on how to automate package installation. There are many commands available to install second generation package but not manage package itself. Then I came across marty chang’s github repository with instruction.

Storing secrets or passwords using manage package in Salesforce – Video

Salesforce supports Encrypted Field out of the box on standard or custom objects. However, users with appropriate profile or permission set can easily view content of those fields. If we want to store secure information like passwords (of external systems), then there is no direct way to achieve this. If we think about passwords, no one should be able to view it. If we forget password, then instead of system sending old password, it forces us to reset it.

We will create same behaviour in Salesforce where stored password cannot be viewed by anyone.

Storing Passwords in Salesforce
Storing Passwords in Salesforce

How to Debug Manage Package in Salesforce

Many times as a developer we need to debug the manage package for possible run time error. For example , while uploading contacts using Import wizard we get “Internal Server Error” and when we try to look into debug log there is no clear indications. However in my experience i have seen this kind of error may be because of manage package installed from AppExchange. As per “Intellectual property” rights , Salesforce cannot show the debug logs to everyone, However there is one way to achieve by System admins to some extent.

For purpose of this article, i am using one manage package from AppExchange to show how it works.