Posts

Showing posts from January, 2025

Encrypt and Decrypt

NODEJS const express = require('express') const app = express() // Middleware to parse JSON request body app.use(express.json()); app.post('/', (req, res) => {   // Includes crypto module   const crypto = require('crypto');   // Defining algorithm   const algorithm = 'aes-192-cbc';   // Defining password   const password = 'bncaskdbvasbvlaslslasfhj';   // Defining key   const key = crypto.scryptSync(password, 'GfG', 24);   console.log(key);   // Defininf iv   const iv = Buffer.alloc(16, 0);    console.log(iv);   // Creating decipher   const decipher =        crypto.createDecipheriv(algorithm, key, iv);   // Declaring decrypted   let decrypted = '';   // Reading data   decipher.on('readable', () => {     let chunk;     while (null !== (chunk = decipher.read())) {       decrypted += chunk.toString('utf8');     }   }); ...

Headless action button using LWC (No Modals)

Image
  A headless quick action executes custom code in a Lightning web component. Unlike a screen action, a headless action doesn’t open a modal window. Expose invoke() as a public method for headless quick actions; the invoke() method executes every time the quick action is triggered. Return type of invoke() is void . Using async will make invoke()  execute asynchronously.  // js file import { LightningElement, api } from 'lwc'; import { ShowToastEvent } from 'lightning/platformShowToastEvent'; export default class DispatchEventHeadlessAction extends LightningElement {     @api recordId;      isExecuting = false;     @api async invoke() {           if (this.isExecuting) {           // This code uses a boolean flag to block a double execution            return;          }           this.isExecuting ...

Keyboard Shortcuts for salesforce developer console

Image
Ctrl + E Open the Execute Anonymous Window. Ctrl + O Open files. Ctrl + Shift + a Open Lightning Resources Ctrl + Shift + h Search in files Ctrl + ALT + / Close all tabs Ctrl + , Navigate backward through the view history Ctrl + . Navigate forward through the view history