This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class OpportunityTriggerHandler { | |
// Method to create the Account-Opportunity Map | |
public static Map<Id, List<Opportunity>> createAccountOpportunityMap(Set<Id> accountIds) { | |
// Step 1: Query Opportunities with related Account Ids | |
List<Opportunity> oppList = [ | |
SELECT Id, AccountId, Name | |
FROM Opportunity | |
WHERE AccountId IN :accountIds | |
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"thisAccount": { | |
"Name": "New Account", | |
"Phone": "1234567890" | |
}, | |
"attachments": [ | |
{ | |
"Body": "Base64EncodedString", | |
"ContentType": "application/pdf", | |
"Name": "document.pdf" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
global class MyBatch implements Database.Batchable<sObject> { | |
global Database.QueryLocator start(Database.BatchableContext context) { | |
// Return query locator for data retrieval | |
} | |
global void execute(Database.BatchableContext context, List<sObject> scope) { | |
// Process batch of records | |
} | |
global void finish(Database.BatchableContext context) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@future | |
public static void myFutureMethod() { | |
// Perform asynchronous task here | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class MyQueueable implements Queueable { | |
public void execute(QueueableContext context) { | |
// Perform long-running task here | |
} | |
} | |
// Enqueue the Queueable job | |
System.enqueueJob(new MyQueueable()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
trigger LeadChangeEventTrigger on LeadChangeEvent (after insert) { | |
LeadChangeEventHandler.publishLeadEvent(Trigger.new); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class LeadChangeEventHandler { | |
public static void publishLeadEvent(List<LeadChangeEvent> leadEvents){ | |
// List to hold the Lead_Created_Event__e records to be published | |
List<Lead_Created_Event__e> leadEventsToAdd = new List<Lead_Created_Event__e>(); | |
Map<String, Object> changedFieldsWithValues = new Map<String, Object>(); | |
// Gather IDs of deleted leads | |
Set<Id> deletedLeadIds = new Set<Id>(); | |
for(LeadChangeEvent leadChangeEvent : leadEvents) { | |
EventBus.ChangeEventHeader header = leadChangeEvent.ChangeEventHeader; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
from sklearn.tree import DecisionTreeClassifier | |
from sklearn.model_selection import train_test_split | |
from sklearn.metrics import accuracy_score | |
# Suppose we have data for smartphone options with features like price, screen size, and camera quality | |
# Let's generate some sample data for demonstration purposes | |
# Features: [price, screen size, camera quality] | |
X = np.array([ | |
[500, 5.5, 12], |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata"> | |
<apiVersion>59.0</apiVersion> | |
<isExposed>true</isExposed> | |
<targets> | |
<target>lightning__AppPage</target> | |
<target>lightning__HomePage</target> | |
<target>lightning__RecordPage</target> | |
<target>lightning__Tab</target> | |
</targets> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public with sharing class getOpportunities { | |
@AuraEnabled | |
public static List<OpportunityWrapper> getAllOpportunities() { | |
List<OpportunityWrapper> opportunityWrapperList = new List<OpportunityWrapper>(); | |
List<Opportunity> opportunityList = [SELECT Id,StageName,Name,Owner.Name, AccountId FROM Opportunity LIMIT 5]; | |
for (Opportunity thisOpp : opportunityList) { | |
OpportunityWrapper wrapper = new OpportunityWrapper(); | |
wrapper.accountId = thisOpp.AccountId; |
NewerOlder