Salesforce Data Dictionary Generator

Salesforce Data Dictionary Generator

This tool will help Salesforce Developer/Administrator to visualize their Schema Object fields.

Christian Pelayo
ยทNov 9, 2022ยท

4 min read

Subscribe to my newsletter and never miss my upcoming articles

Play this article

Table of contents

๐Ÿ‘‹ Introduction

A Web-Based tool for generating Salesforce Data Dictionary supported with Oauth2 Salesforce Authentication. This tool will help Salesforce Developer/Administrator to visualize their Schema Object field's pre-selected important attributes rather than visiting Salesforce Object Manager. It can export multiple schema objects to excel with fancy cell color and a Datatable for viewing the selected Schema Object.

Start blogging with Hashnode

Resources

Github Repository

Published Site

Tech Stack:

๐Ÿ“ท Screen Shots

Figure 1 - Duel Picklist ss_01.png

Figure 2 - SObject Datatable ss_02.png

Figure 3 - Exported Excel File ss_03.png

โšก๏ธ One-click Deployment to your own Vercel Account

Using the Vercel Deploy Button, you can quickly deploy this project into your own Vercel Account.

Deploy with Vercel

After clicking the Deploy button above, it will redirect to your Vercel Account, you'll see similar to the following screenshot bellow.

  1. Vercel will ask you to link your Github, Gitlab, or Bitbucket. In this demo it uses Github, then populate the Repository Name and click Create. vercel_create_repo.png

  2. Next, it will proceed on setting up the Environment Variables needed for this project to run smoothly, then click Deploy vercel_add_env_var.png

๐Ÿง‘โ€๐Ÿ”ง Pre-Work

Create Connected App in Salesforce

  1. Log in to Salesforce as an administrator.
  2. In the drop-down list of the account (in the upper-right corner), select Setup.
  3. Go to App Setup > Create > Apps in the left-hand pane.
  4. In the Connected Apps pane, click the New button.
  5. On the New Connected App page, fill the following required fields under Basic Information:
    • Connected App Name. For example, SF-Dictionator Demo.
    • API name. For example, SF-Dictionator Demo.
    • Contact Email.
  6. Go to API (Enable OAuth Settings), and select Enable OAuth Settings.

    • In the Callback URL field, enter http://localhost:3000/api/auth/callback/salesforce and https://YOUR_VERCEL_APP_URL/api/auth/callback/salesforce.
    • In the Selected OAuth Scopes field, for this demo, I added all available scopes. On your end you can only select Access and manage your data (API), and then click Add.

      enable_oath_settings_config.png

  7. Click the Save button to save the new Connected App.

  8. In the Connected Apps list, find the App that you just created, and then click Manage.
    • On the page that opens, click the Edit button.
    • Under OAuth policies, select All users may self-authorize in the Permitted Users list, and then click the Save button.
  9. Go back to the Connected Apps list, and click the App that you just created.
  10. Go to API (Enable OAuth Settings), and note down the Consumer Key and Consumer Secret, which will be used for the configuration of Environment Variables.

๐Ÿง‘โ€๐Ÿ’ป Environment Variables

For local installation, create .env.local in the root folder of the project.

SALESFORCE_CLIENT_ID=YOUR_CLIENT_KEY
SALESFORCE_CLIENT_SECRET=YOUR_SECRET_KEY
SALESFORCE_URL_LOGIN=https://login.salesforce.com

NEXTAUTH_URL=http://localhost:3000
NEXTAUTH_SECRET=YOUR_NEXTAUTH_SECRET

To generate NextAuth Secret you can use this app: generate-secret.vercel.app/32

๐Ÿ›‘ Security

How is your token being used or stored?

On this tool, your token is not stored in any databases. With the use of Next-Auth after the Salesforce Authenticate the user, using JWT provided by the Next-Auth only the token is used, and the session with a maximum TTL of 2 hours.

How can we keep the user still log in after 2 hours straight with the active session?

By using Refresh Rotation Strategy and refresh the token with a 15 minutes buffer time before the expiration of the token.

โšก๏ธ Local Machine Installation

Before firing up the project make sure you already set your Environment Variables.

git clone https://github.com/pelayochristian/sf-dictionator.git
cd sf-dictionator
npm install

For Development, run the below command.

npm run dev

For running the Production Ready package, run the below command.

npm run build && npm run start

Open localhost:3000 with your browser to see the result.

Conclusion

Excellent! ! ! check the github repository of this project and I hope it helps. If found some issues or bugs don't hesitate to log an issues๐Ÿ˜‰ Thank you! Happy hacking ... ๐Ÿ’ป

Did you find this article valuable?

Support Christian Pelayo by becoming a sponsor. Any amount is appreciated!

Learn more about Hashnode Sponsors
ย 
Share this