Set up Permissions for Accessing Salesforce

Before we move any further, we must ensure that the Function that we created has appropriate permissions to access Salesforce objects when it’s run in the Salesforce compute environment. Currently no permission set exists in our project. Create permissions for Account and FunctionInvocationRequest using the following steps:

  1. Use the SFDX:Open Default Org palette command to open your org.
  2. In your org, navigate to Setup > Permission Sets > Functions.
  3. Open Functions > Object Settings > Account
  4. Click Edit.
  5. Check Read, Create, and Edit. Save your changes.
  6. Open Functions > Object Settings > FunctionInvocationRequest
  7. Click Edit.
  8. Check Delete, Edit, Read, ModifyAll, and ViewAll.
  9. Click Save to save the Functions permission set.

Note: If you’re a developer with multiple scratch orgs in your development environment, an org without Functions enabled may have been set as the default scratch org. You can open the correct scratch org with SFDX: Authorize an Org and choose the org alias that you had set earlier, and then run steps 1 through 9.

Now pull this permission set from the scratch org into your project using the SFDX: Pull Source from Default Scratch Org and Override Conflicts VS Code palette command.