Apex Triggers - 20 (Cognizant Interview Scenario)

preview_player
Показать описание
Revolutionize your Salesforce experience with Titan's powerful products

Рекомендации по теме
Комментарии
Автор

Thank you very much ❤. How can i post you some tricky interview questions so that you can make videos?

SandeepRahoolPV
Автор

Really Wonderful, When I read the question then I also think the same to solve this. this is mainly asked.

YashSharm
Автор

I find Salesforce interesting now.
Thank yoj

arunimakashyap
Автор

We can create Map of opportunity Id, list of products in the first loop itself when we are looping in trigger.new products so that we can know for each opportunity Id how many products are there from values size() and then we query on keyset of the map that is oportunity Id to get account Id and then 2nd loop on query result and update account with list size of the map values...

This can also be done in this way right... Any suggestions?

tadukavamshikrishna
Автор

This works fine but there could be another scenario when the number of opportunities are more than one linked to one account :)

manoharsingh
Автор

Sir Shouldn't we also check that whenever a Opp line item changes it's parent parent Opportunity the account related to it should also update using Opp Line Item old Map

partapchahal
Автор

whats the need to check the Trigger. new empty or not since if there is no CRUD operation, then trigger will not get fired no. I am unable to understand this. Can anyone please explain this please. Thanks in advance.

ramyakotha
Автор

Hi,

on updating the Account of an Opportunity, the number_of_products aren't updating! Any solution for that?

jatinpal
Автор

Hi, i need your help ! i want to create a apex trigger so that A Credit score range should be updated automatically whenever value in credit score is updated. For example If Credit score is updated to 600, then the credit score range should be updated to "699 and below".
(Credit score range which includes values -"699 and below", "700-719", "720-749" and "750 and above") can you help with the code ?

sani
Автор

But how it will work if there is more than one opportunity

palashdhande
Автор

can you please expalin me line 31 in map, what you are storing the key AccountId or opporrtunityId

shahabazahmed
Автор

we can also do this way
if(trigger.isbefore && trigger.isInsert) {
set<id> setofaccid=new set<id>();
for(Contact con:trigger.new){
if(con.AccountId!=null){
Integer ContactCount = [SELECT COUNT() FROM Contact WHERE AccountId = :con.AccountId];

if(ContactCount!=null){

if (ContactCount >= 2) {
con.addError('contact cannot be created to account');
}
}
}
}

}

gauravjoshi
Автор

Thanks for sharing the scenario but I believe you should really work on explanation .After going through video, I have observed that you are doing practice for yourself.

SunnySingh-mssr