Posts

Showing posts with the label nortification

Tip of the week # 217 : Apex Trigger Best Practices

Image
Salesforce : Apex Trigger Best Practices Description : Apex Triggers in Salesforce are a powerful way to extend platform functionality. They enable developers to perform custom actions before or after record changes such as insert, update, or delete operations. To maintain high code quality and performance, it is essential to write efficient and optimized trigger logic. While triggers provide a high degree of flexibility and control, following best practices is crucial to ensure that the code remains scalable, maintainable, and efficient. Apex Trigger Best Practices : One trigger per object We should always write one trigger per object, as having multiple triggers on the same object can cause unexpected behavior due to the lack of a guaranteed execution order. To avoid this, consolidate all trigger logic for an object into a single trigger and delegate the detailed processing to helper classes. This approach improves clarity, maintainability, and control ov...

Tip of the week # 216 : Salesforce Composite and Composite Tree API

Image
Salesforce Composite and Composite Tree API with Examples Description : Executes a series of REST API requests in a single POST request, or retrieves a list of other composite resources with a GET request. Salesforce REST Composite API's : Salesforce REST Composite : To perform multiple REST API calls in a single request.Batch multiple API sub-requests together, execute sequentially (or in parallel), and optionally reference results between them. Method:- Post (For Insert) URL:-/services/data/v64.0/composite Request Body :- { "compositeRequest": [ { "method": "POST", "url": "/services/data/v64.0/sobjects/Account", "referenceId": "newAccount", "body": { "Name": "Test Account" } }, { "method": "POST", "url": ...

Tip of the week # 215 : Salesforce REST API

Image
Salesforce REST API's with Examples Description : Salesforce REST API allows external applications to interact with Salesforce using HTTP methods like GET, POST, PATCH, and DELETE. It streamlines CRUD operations, making integrations simpler and more efficient. Types of Salesforce REST API's : Standard REST API : For basic record operations. (Below example for create account via REST API) Method:- Post URL:- /services/data/v36.0/sobjects/Account/ Request Body :- { "Name" : "Account from Rest API", "phone" : "1111111111", "website" : "www.salesforce1.com", "numberOfEmployees" : "100", "industry" : "Banking" } Response Body :- { "id" : "00190000001pPvHAAU", "errors" : [ ], "success" : true, ...

Tip of the week # 214 : Lightning Datatable with Mask and Unmasked

Image
Lightning Datatable with Mask and Unmasked Description : lightning-datatable displays tabular data where each cell with field values and value should be masked and unmasked. ADVANCED OPTIONS FOR lightning-datatable IN LWC : Component HTML Component JS import { LightningElement, track, api } from 'lwc'; import getContacts from '@salesforce/apex/ContactController.getContacts'; export default class MaskComp extends LightningElement { @track accounts; @api recordId; columns = [ { label: 'First Name', fieldName: 'FirstName', type: 'text' }, { label: 'Last Name', fieldName: 'LastName', type: 'text' }, { label: 'Email', fieldName: 'maskedEmail', type: 'button', ...

Tip of the week # 213 : Set up reCAPTCHA for Experience Cloud Site

Image
Set up reCAPTCHA for Experience Cloud Site Description : Set up reCAPTCHA in the Experience Cloud sites to ensure that the provider applications are filled in by humans, not bots.. Steps are following : Generate a Google reCAPTCHA site key, and copy the site key. For more information, From Setup, in the Quick Find box, enter Digital Experiences, and select All Sites. Click Builder next to the Experience Cloud site for your providers. Configure the security settings In the Settings section, select Security and Privacy. Click Edit Head Markup, and then paste this code: Make sure Lightning Locker is turned on. To add Google as a trusted site, click Add Trusted Site. For Name, enter Google. For URL, enter https://www.google.com. Make sure Active is selected, and then click Add Site. To add gstatic as a trusted site, click Add Trusted Site. For Name, enter gstatic. For URL, enter https://www.gstatic.com. Make su...

Tip of the week # 212 : Lightning Datatable hidden gems

Image
Lightning Datatable hidden gems Description : lightning-datatable displays tabular data where each column renders the content based on the data type. ADVANCED OPTIONS FOR lightning-datatable IN LWC : Displaying and formatting of columns with appropriate data types const columns = [ { label: 'Opportunity name', fieldName: 'OpportunityName', type: 'text' }, { label: 'Probability', fieldName: 'Probability', type: 'percent', cellAttributes: { iconName: { fieldName: 'TrendIcon' }, iconPosition: 'right', }, }, { label: 'Amount', fieldName: 'Amount', type: 'currency', typeAttributes: { currencyCode: 'EUR', step: '0.001' }, }, { label: 'Contact Email', fieldName: 'Contact', type: '...

Tip of the week # 208 : Lifecycle hooks in LWC

Image
Lifecycle hooks in Lightning Web Components (LWC) Description : In Lightning Web Components (LWC), lifecycle hooks are special methods that allow you to run code at specific points during a component's lifecycle — such as when it is created, inserted into the DOM, or removed or when reactive variables are changed. constructor() : Called when the component instance is created (before rendering or attaching to the DOM). import { LightningElement } from 'lwc'; export default class LifcCyclehook extends LightningElement { constructor() { super(); // always call super() for calling parent class constructor i.e LightningElement console.log('Constructor called'); } } Ideal for below used : Initialize default values for private properties but not for public properties. connectedCallback() : Called when the component is inserted into the DOM. ...

Tip of the week # 205

Image
Lightning Web Component with Youtube Controls. Description : Code snapshot for Lightning Web Component with Youtube Controls. YoutubePlayback.html YoutubePlayback.js import { LightningElement } from 'lwc'; import { ShowToastEvent } from 'lightning/platformShowToastEvent'; export default class YoutubePlayback extends LightningElement { iframeElement = null; playerReady = false; volume = 100; playbackSpeed =1; playbackSpeedOptions = [ { label: '0.5x', value:0.5}, { label: '1x...

Salesforce : Consultant Tip's 2024

Image
Salesforce : Consultant Tip's 2024 Many people are requesting to show all the tips as a web page so they can easily checkout for your usages so I'm creating a blogger for my followers and friends. : Tip of the week # 162 : Deploy Metadata Using REST API. Description : SDeploy using the deployRequest REST resource to initiate a request that handles all operations for the deployment. EndPoint : https://host/services/data/vXX.0/metadata/deployRequest Format : JSON Method : POST Authorization: Bearer token You can deploy or retrieve up to 10,000 files at once. AppExchange packages use different limits: They can contain up to 35,000 files. The maximum size of the deployed or retrieved .zip file is 39 MB. If the files are uncompressed in an unzipped folder, the size limit is 400 MB. Tip of the week # 161 : Styling Hooks for LWC. Description : Styling hooks use CSS custom properties which make it easy to customize component sty...

Salesforce : Multi-Factor Authentication

Image
Salesforce : Multi-Factor Authentication Evidence that users provide when logging in to confirm their identity.. One factor is something users know. For Salesforce logins, with user credeantial Two factors are verification methods that a user has in their possession, such as a mobile device with an authenticator app installed or a physical security key. How Multi-Factor Authentication Works 1. A user enters their username and password, as usual. 2. A user is prompted to provide one of the verification methods that Salesforce supports.. Salesforce verification methods: Salesforce Authenticator : A free mobile app that integrates seamlessly into your login process from Salesforce Third-party authenticator apps : This code is sometimes called a time-based one-time password, or TOTP for short. Users can pick from a wide variety of options, including Google Authenticator, Microsoft Authenticator, or Authy. Security keys : Small physical tokens that look like...

Salesforce LWC : Compact Layout on Hover

Image
Salesforce LWC : Compact Layout showing on Hover Sometime we have requirement to show Account name link on standard views, a popup with the Compact Layout shows the details of that record. LWC Parent Component : Template (HTML Code) LWC : JS (Process Code) import { LightningElement,api } from 'lwc'; export default class AccountComponent extends LightningElement { @api recordId; @track objRecordId; handleMouseover(event) { console.log(this.recordId); this.objRecordId = null const toolTipDiv = this.template.querySelector('div.ModelTooltip'); toolTipDiv.style.opacity = 1; toolTipDiv.style.display = "block"; // eslint-disable-next-line window.clearTimeout(this.delayTimeout); // esli...

Salesforce LWC With Third Party JS : D3

Image
Salesforce Lightning Web Component With Third Party JS : D3 Third-Party JavaScript Libraries Using JavaScript to manipulate the DOM isn’t recommended because the Lightning Web Components engine does it more efficiently. However, there are some third-party JavaScript libraries that take over the DOM. Manipulate the DOM with JavaScript Using JavaScript to manipulate the DOM isn’t recommended because the Lightning Web Components engine does it more efficiently. However, there are some third-party JavaScript libraries that take over the DOM. If a call to appendChild() manipulates the DOM, styling isn’t applied to the appended element. When using these libraries in a Lightning web component, add lwc:dom="manual" to any HTML element that you want to manipulate with JavaScript. When the engine sees the directive, it preserves encapsulation. Add the lwc:dom="manual" directive to an empty native HTML element. The owner of the component calls appendChild()...

Salesforce : Certification Tip for Online Protected With Coupons/Vouchers

Image
Salesforce : Certification Tip for Online Protected What is an Online Proctored Exam? Salesforce certification exams can be taken remotely, from your own computer, at the comfort of your home. online proctored exam for online proctored is very convenience, flexibility in schedule, and no travel requirements .  Online Proctored Exam Requirements The online proctored exams are taken via Kryterion Sentinel Secure software . Those taking the tests must download the software and create a biometric profile. You must verify your identity before your exam schedule. Review all the requirements before taking an exam to ensure a successful attempt. Any rule violation could be grounds to discontinue your online proctored exam. To guarantee secure examination conditions, your testing area must meet these requirements : 1. Area must be quiet and clear with good amount of visibility for WebCam. 2. Usually, an online proctored exam requires two cam external cameras and built in w...