Skip to content

Instantly share code, notes, and snippets.

@sfdevmaster
sfdevmaster / ContactTrigger.java
Last active May 14, 2025 08:41
ContactTrigger Without Recursion
/**
* ContactTrigger
*
* This trigger handles after-update operations on the Contact object.
* It delegates the processing logic to the `ContactTriggerHandler` class to ensure a clean separation of concerns.
*
* Trigger Context:
* - Executes in the after-update context.
*
* Key Features:
@sfdevmaster
sfdevmaster / CaseTrigger.java
Last active May 14, 2025 05:25
Case & Contact Trigger Without Recursion
//Case Trigger Without Recursion
/**
* CaseTrigger
*
* This trigger is executed after the update event on the Case object. Its purpose is to:
* - Monitor changes to the Case's Status field.
* - If the Status changes to 'Escalated':
* - Retrieve the associated Contact record linked to the Case.
* - If the Contact's Title is not already 'Manager', update it to 'Manager'.
*
@sfdevmaster
sfdevmaster / CaseTrigger.java
Created May 14, 2025 04:56
Case & Contact Trigger With Recursion
//Case Trigger With Recursion
/**
* CaseTrigger
*
* This trigger is executed after the update event on the Case object. Its primary purpose
* is to check if any Case record has been escalated (Status = 'Escalated') and update the
* associated Contact's Title to 'Manager' if it is not already set to 'Manager'.
*
* Note: This implementation directly queries and updates the Contact records.
* Care should be taken to ensure compliance with Salesforce Governor Limits,
@sfdevmaster
sfdevmaster / OpportunityTrigger.java
Last active May 13, 2025 16:53
Opportunity Trigger With Recursion Fix
// Opportunity Trigger with Recursion Fix
/**
* OpportunityTrigger
*
* This trigger is responsible for handling "before update" and "after insert" events
* on the Opportunity object. It delegates the logic to a handler class (OpportunityTriggerHandler)
* while utilizing a utility class (TriggerUtility) to prevent recursive execution.
*/
trigger OpportunityTrigger on Opportunity (before update, after insert) {
@sfdevmaster
sfdevmaster / OpportunityTrigger.java
Last active May 13, 2025 17:03
Opportunity Trigger With Recursion
//Opportunity Trigger With Recursion
/**
* OpportunityTrigger
*
* This trigger is responsible for handling "before update" and "after insert" events
* on the Opportunity object. It directly contains the logic for updating specific
* fields based on conditions, ensuring proper data updates during these events.
*
* Note: This trigger does not use a handler class or utility class for recursion control.
* Instead, it executes the logic inline, which might lead to recursion issues in certain scenarios.
@sfdevmaster
sfdevmaster / leafletMap.html
Created May 4, 2025 14:08
Leaflet Map Example in LWC
<!--leafletMap.html-->
<template>
<div class="container" lwc:dom = "manual"></div>
</template>
@sfdevmaster
sfdevmaster / simplePluginLwc.html
Last active May 3, 2025 11:43
Applying Script On DOM Element Dynamically LWC
<!--simplePluginLwc.html-->
<template>
<lightning-card title="Plugin Load From External Script Example – LWC" icon-name="custom:custom14">
</lightning-card>
</template>
@sfdevmaster
sfdevmaster / myvfpage.html
Last active May 15, 2025 05:37
Calling LWC Inside VF Page and Passing Global Function from Script to LWC
<!--myvfpage.html-->
<!-- Define a Visualforce page with specific settings:
- `showHeader="false"`: Hides the Salesforce header.
- `standardStylesheets="false"`: Disables the default Salesforce stylesheets.
- `sidebar="false"`: Removes the sidebar.
- `applyHtmlTag="false"`: Prevents Salesforce from adding an automatic <html> tag.
- `applyBodyTag="false"`: Prevents Salesforce from adding an automatic <body> tag.
- `docType="html-5.0"`: Specifies the HTML5 doctype for modern web standards. -->
<apex:page showHeader="false" standardStylesheets="false" sidebar="false" applyHtmlTag="false" applyBodyTag="false" docType="html-5.0">
@sfdevmaster
sfdevmaster / myLwcComponent.html
Last active May 3, 2025 16:50
LWC calling VF Page Script Method
<!--myLwcComponent.html-->
<template>
<lightning-card title="LWC called in VF Page via Lightning Out Component" icon-name="custom:custom14">
<div class="slds-p-around_medium">
<button onclick={handleClick}>Call Utility Method</button>
</div>
</lightning-card>
</template>
@sfdevmaster
sfdevmaster / myLwcComponent.html
Last active May 3, 2025 06:49
LWC Limitation while calling VF Page Script Method
<!--myLwcComponent.html-->
<template>
<lightning-card title="LWC called in VF Page via Lightning Out Component" icon-name="custom:custom14">
<div class="slds-p-around_medium">
<p>This is a sample component for learning How to display LWC in Visualforce Page. You can customize it as needed.</p>
</div>
</lightning-card>
</template>