Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  • I want to have a few aliases to shortcut DX commands

  • I want to have a script that I can create a scratch org with

That’s about it.

Trailhead

This module might be helpful https://trailhead.salesforce.com/content/learn/modules/cli-basics

But you DO NOT NEED NODE OR NPM! (Yet). So ignore the Mac specific bits in the third module.

Getting Started

Well, you need to start at the begining… and gee is that hard. First of all just how many versions of Powershell are there? And does it need to be stand-alone or can it run in VS Code?

...

I found a simple set of instructions that were basically the same as Peter’s instructions… the trick is to start in VS Code and don’t leave VS Code. And don’t install the Powershell VS Code Extension.

I found this article to be helpful.

Code Block
Test-Path $profile

...

this returns the folder where the profile is stored. I opened the folder in my file explorer then opened the profile file in vscode.

The file is Microsoft.PowerShell_profile.ps1 and is created in C:\Users\<username>\Documents\PowerShell\

You may also need to do the following, but I’m not sure because it was all very confusing. Try it without using this command and report back. “If the Execution Policy is set to RemoteSigned, you can run only foreign scripts from Trusted Publisher, but you can also run your own scripts (that are not signed).” From this article.

Code Block
 Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser

...

Paste the contents of Peter Chittum’s sample profile into that file https://github.com/pchittum/everyday-sfcli/blob/master/utils/powershell-profile/Set-RecommendedProfileItems.ps1 and save. . But remove the cd~ at the top as that changes the directory out of your current working SFDX directory and you don’t want that.

Save, then Reload VS Code.

Open the terminal and type:

Code Block
dxlist

A list of your scratch orgs appear! Magic!

...

The default org is now set.

Now Once the default org is set, you can use the window icon in the status bar to open that org.

...