Grand Parent Update Trigger || Boss Trigger || Complex Trigger for practice from scratch

  Рет қаралды 2,709

Salesforce & Interviews

Salesforce & Interviews

4 ай бұрын

Trigger Scenario - Update account with number of opportunity Line Items associated.

Пікірлер: 9
@Soujisfmails
@Soujisfmails 4 ай бұрын
very nice explanation
@goku6986
@goku6986 4 ай бұрын
❤ Awesome sir
@SunilSharma-ui9sx
@SunilSharma-ui9sx 4 ай бұрын
Hi Sir ,How can I join your Interview preparation batch.
@shubhenduprakash588
@shubhenduprakash588 4 ай бұрын
Can this be done by flow?
@bhi_bandari
@bhi_bandari 3 ай бұрын
yes
@prasadchendake998
@prasadchendake998 4 ай бұрын
Hii , great explanation . Are you providing any opportunities for experience candidate.
@Soujisfmails
@Soujisfmails 4 ай бұрын
I modified little bit and included after delete event also trigger CountOfOLIonAcc on OpportunityLineItem (after insert,after delete ) { Set oppIds = new Set(); Set accIds = new Set(); List newoplineList = new List(); newoplineList = (Trigger.isInsert? Trigger.New : Trigger.Old); for(OpportunityLineItem op :newoplineList) oppIds.add(op.OpportunityId); for(Opportunity op :[Select AccountId , id from Opportunity WHERE Id IN :oppIds ]) accIds.add(op.AccountId); List aggroliList = [SELECT Opportunity.AccountId acId, count(id) oliCnt FROM OpportunityLineItem WHERE Opportunity.AccountId IN :accIds group by Opportunity.AccountId]; Map OLIcnt = new Map(); for( AggregateResult oli : aggroliList) { OLIcnt.put( (Id)oli.get('acId'), (Integer)oli.get('oliCnt') ); } List newUpAccList = new List(); for(Id accId:accIds){ Account ac = new Account(Id = accId); if(OLIcnt.containsKey(ac.Id)) ac.Count_OLI__c = OLIcnt.get(ac.Id); newUpAccList.add(ac); } update newUpAccList; }
КАК ДУМАЕТЕ КТО ВЫЙГРАЕТ😂
00:29
МЯТНАЯ ФАНТА
Рет қаралды 10 МЛН
Clowns abuse children#Short #Officer Rabbit #angel
00:51
兔子警官
Рет қаралды 79 МЛН
Spot The Fake Animal For $10,000
00:40
MrBeast
Рет қаралды 178 МЛН
Salesforce Integration Patterns
1:06:59
Devfacts
Рет қаралды 6 М.
Microservices with Databases can be challenging...
20:52
Software Developer Diaries
Рет қаралды 21 М.
The WEIRD Reason You're Attracting Emotionally Unavailable People
26:21
Introduction to NoSQL databases
26:18
Gaurav Sen
Рет қаралды 770 М.
MongoDB Internal Architecture
43:25
Hussein Nasser
Рет қаралды 84 М.
КАК ДУМАЕТЕ КТО ВЫЙГРАЕТ😂
00:29
МЯТНАЯ ФАНТА
Рет қаралды 10 МЛН