Posts

15 Salesforce Apex Trigger Scenarios

  Welcome to Salesforce Hours! If you’re looking to sharpen your Salesforce development skills with real-world examples and practical tutorials, you’re in the right place. In this  Part 1 of our “Salesforce Apex Trigger Scenarios “, we’re diving into some of the most common and sometimes tricky use cases you’ll come across when working with Apex triggers. These examples are built around standard Salesforce objects and designed to mirror the actual interview question that are asked in most of the Salesforce interview . You’ll find  clean, scalable Apex code  solutions that not only solve problems but also follow best practices. Whether you’re just getting started or refining your skills, this guide is here to help you grow confidently as a Salesforce developer. Table of Contents Scenario 1: Update Account Type When Opportunity is Closed Won Scenario 2: Prevent Contact Creation Without Account Scenario 3: Roll Up Total Opportunity Amount to Account Scenario 4: Clone Op...

How to use Named Credentials to simplify your Apex

public class GithubOAuthCallout {         public static void callGitHub (){         HttpRequest req = new HttpRequest ();         req . setEndpoint ( 'callout:GitHub_OAuth/users/Coding-With-The-Force/repos' );         req . setMethod ( 'GET' );         req . setHeader ( 'Accept' , 'application/json' );         req . setHeader ( 'Content-Type' , 'application/json' );         Http http = new Http ();         HTTPResponse res = http . send ( req );         if ( res .getStatusCode() == 200) { System.debug('Response: ' + res .getBody()); } else { System.debug('Error: '+ res .getStatusCode() + ' - ' + res .getBody()); }     } }  

Events in Lightning web components (LWC) and LDS

Image
 Types of Events Parent to Child Event communication in Lightning web component Custom Event Communication in Lightning Web Component ( Child to Parent  ) Publish Subscriber model in Lightning Web Component or  LMS  ( Two components which doesn’t have a direct relation  ) 1) Parent to Child Event communication in LWC childComp.html <template> Message Will Come here from Parent Component :- {Message} </template> childComp.js import { LightningElement, track, api } from 'lwc'; export default class ChildComponent extends LightningElement { @track Message; @api changeMessage(strString) { this.Message = strString.toUpperCase(); } } ParentComponent.html <template> <lightning-card title="Parent to Child Demo"> <lightning-layout> <lightning-layout-item flexibility="auto" padding="around-small" > <lightning-input label="Enter the Message...