Apex Triggers - 52 (IBM Interview Scenario)

  Рет қаралды 1,186

SFDC Ninja

SFDC Ninja

Күн бұрын

💻 Join the Titan Community : Discover Exclusive Insights on LinkedIn / mycompany
💻 Explore the Power of Titan : Visit Our Official Website Now 🔗 titandxp.com/

Пікірлер: 9
@goldylodhi2116
@goldylodhi2116 20 күн бұрын
Thanks sir ❤ nice explanation
@adityasinghbisen4215
@adityasinghbisen4215 20 күн бұрын
the trigger will run every time the record is updated when the amount is more than 10k , we should have checked if the values has changed and then only allow the logic to run.
@crazyvlogs2366
@crazyvlogs2366 16 күн бұрын
Hi whenever u create a video on trigger scenarios which are asked in real time interviews please make sure that u must inform the experience level. I hope you follow it.
@sfdcninjas
@sfdcninjas Күн бұрын
Sure i will follow it but sometimes people just comment about the scenario and company in which it is asked not the experience.
@parthipan0345
@parthipan0345 19 күн бұрын
Can we do soql query directly ownerid owner.name from opportunity instead of using map and query on user. Right .?
@kumareshghosh5593
@kumareshghosh5593 20 күн бұрын
You did not differentiate the update operation where every time the amount gets 10000 , trigger will run, but it should check previous oldMap value and then send mail I guess, however using map was not necessary for user there so I implemented my code: public with sharing class amountOwnerHandler { //if any opportunity is created or updated and amount is greater than 10000,then send an email to the record owner regarding the DML operation. public static void afterOperation(List newOpps, Map oldMapOpps){ set ownerIds=new Set(); for(opportunity opps:newOpps){ //for insert if(opps.amount!=null && opps.amount>=10000 && oldMapOpps==null){ ownerIds.add(opps.OwnerId); } //for update if(opps.amount!=null && oldMapOpps!=null && opps.amount>=10000 && oldMapOpps.get(opps.id).amount
@nikhilvadithala
@nikhilvadithala 20 күн бұрын
Can you provide solution for below scenario Asked in accenture interview Opportunity has a relationship with child object opportunity line item When ever opportunity stage is updated as closed/won The status/ any text field on most recently modified child record should be updated as approved And for remaining records field should be updated as rejected In case the opportunity stage is updated as closed/lost Most recent child record status should be updated as lost and remaining child records should be updated as rejected
@user-pc2tf7im5b
@user-pc2tf7im5b 19 күн бұрын
Hey @nikhilvadithala, Try this approach and let me know, if you face any difficulty in understanding code. Set oppIds = new Set(); for (Opportunity op : newOpps) { if ( (op.StageName == 'Closed Won' || op.StageName == 'Closed Lost') && (oldOpps.get(op.Id).StageName != op.StageName) ) { oppIds.add(op.Id); } } if (oppIds.size() > 0) { List oppList = [SELECT Id, StageName, (SELECT Id, Description FROM OpportunityLineItems ORDER BY LastModifiedDate DESC) FROM Opportunity WHERE Id IN :oppIds]; List oppLineItemList = new List(); if (oppList.size() > 0) { for (Opportunity op : oppList) { if (op.OpportunityLineItems.size() > 0) { for (Integer i = 0; i < op.OpportunityLineItems.size(); i++) { if (op.StageName == 'Closed Won') { op.OpportunityLineItems[i].Description = (i == 0) ? 'Approved' : 'Rejected'; oppLineItemList.add(op.OpportunityLineItems[i]); } else if (op.StageName == 'Closed Lost') { op.OpportunityLineItems[i].Description = (i == 0) ? 'Lost' : 'Rejected'; oppLineItemList.add(op.OpportunityLineItems[i]); } } } } } if (oppLineItemList.size() > 0) { try { update oppLineItemList; } catch (Exception e) { System.debug('Error while updatation!'+e); } } }
Apex Triggers - 53 (Trigger Interview Scenario)
13:22
SFDC Ninja
Рет қаралды 1 М.
Apex Triggers - 51 (NTT Data Interview Scenario)
15:43
SFDC Ninja
Рет қаралды 1,6 М.
$10,000 Every Day You Survive In The Wilderness
26:44
MrBeast
Рет қаралды 86 МЛН
How many pencils can hold me up?
00:40
A4
Рет қаралды 19 МЛН
Tell me about yourself | Interview Question #1
0:59
Apna College
Рет қаралды 13 МЛН
Introducing Bujji | Kalki 2898 AD | Prabhas | Nag Ashwin | Vyjayanthi Movies
0:58
Salesforce Batch Apex Interview Questions
9:38
SFDC Ninja
Рет қаралды 3,7 М.
Apex Triggers  - 50 (NTT Data Interview Scenario)
8:16
SFDC Ninja
Рет қаралды 1,5 М.
System Design Interview: A Step-By-Step Guide
9:54
ByteByteGo
Рет қаралды 584 М.
Задача APPLE сделать iPHONE НЕРЕМОНТОПРИГОДНЫМ
0:57
МОЖНО ЛИ заряжать AirPods в чехле 🧐😱🧐 #airpods #applewatch #dyson
0:22
Apple_calls РЕПЛИКА №1 В РФ
Рет қаралды 23 М.
POCO F6 PRO - ЛУЧШИЙ POCO НА ДАННЫЙ МОМЕНТ!
18:51