Тёмный
No video :(

Trigger to count number of Contacts with an account 

Programming Made Easy
Подписаться 3,9 тыс.
Просмотров 21 тыс.
50% 1

#ProgrammingMadeEasy
Hello and welcome to Programming Made Easy. In this video we would be discussing more on Triggers. In the Previous video we talked about sibling trigger, how to create it and the best practices involved. In this video we would be discussing more on triggers and the trigger for today is to count the total contacts associated with an account in salesforce.
Trigger to count number of contacts associated with an account,
Display the total number of contacts on account detail page,
Count number of contacts on accounts using Trigger ,
How do I find the number of contacts associated with an account in Salesforce?
Count the Contacts in the related list of Account ,
Salesforce | How can we count number of contacts ,
How to use trigger to count number of contacts associated ,
Salesforce Apex: How to Track the Number of Contacts,
Trigger to update number of contacts associated with account,
Salesforce: Trigger to count total no of contacts in an account ,
Account Contact Trigger Scenario,
Trigger scenario(when account address is updated related contact address also updates)

Опубликовано:

 

5 сен 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 53   
@swatisharma-oz6df
@swatisharma-oz6df Месяц назад
Can you take this one in your next video. write a trigger to get the product count of opportunity and update count field on account
@ProgrammingMadeEasy99
@ProgrammingMadeEasy99 Месяц назад
Sure will do
@sumitkumarojha3251
@sumitkumarojha3251 Год назад
Awesome Man. Without using Map you have solved this problem very well.
@slaidwar
@slaidwar 2 года назад
why you put update accounts(); on line no 32 which is outside the if block, you can put this on line no 30 ... ???
@ProgrammingMadeEasy99
@ProgrammingMadeEasy99 2 года назад
Yes we could have put that in line number 30.
@programtime5526
@programtime5526 2 года назад
very helpful video sir . Thanks alot
@nikitaghai9248
@nikitaghai9248 2 года назад
Great 👍
@ProgrammingMadeEasy99
@ProgrammingMadeEasy99 2 года назад
Thanks alot maam
@lalitkatare3475
@lalitkatare3475 Год назад
Can you also add after delete event
@padalapallavi2011
@padalapallavi2011 2 года назад
How to get the count along with existing records? It is working only for newly created ones.
@ProgrammingMadeEasy99
@ProgrammingMadeEasy99 2 года назад
It works when we contact is created
@arun6479
@arun6479 2 года назад
Thanks Brother ..
@rajeevranjan3718
@rajeevranjan3718 2 года назад
Very helpful video. can you provide the test class also for this?
@ProgrammingMadeEasy99
@ProgrammingMadeEasy99 2 года назад
Sure we would work upon this as well.
@nishantkumar-vv8pf
@nishantkumar-vv8pf 2 года назад
why we didnt created another list for storing the updated no of count vaues
@ProgrammingMadeEasy99
@ProgrammingMadeEasy99 2 года назад
You can do that also but always remember 1 thing that map is more capable than list both in terms of space time so try using that. This is a beginner friendly video but in future videos we would be going more deep into these things
@nishantkumar-vv8pf
@nishantkumar-vv8pf 2 года назад
@@ProgrammingMadeEasy99 thanks for the reply and valuable input sir... My question was as on line number 32...you did update accounts directly.. but usually we create a list and addd the records which we have updated ( like updatelist.add(acc)) and then we update that list (line number 32) But here you have directly updated . So what is the concept behind this that we can do directly the way u did n when we need to take another list put all update records n the update as a whole
@hariharannatarajan7208
@hariharannatarajan7208 2 года назад
we should also write the logic for the after delete and after undelete operations then only the solution will be a complete one
@ProgrammingMadeEasy99
@ProgrammingMadeEasy99 2 года назад
Yes correct. Actually this was just to give an Idea
@hariharannatarajan7208
@hariharannatarajan7208 2 года назад
@@ProgrammingMadeEasy99 ok bro
@ProgrammingMadeEasy99
@ProgrammingMadeEasy99 2 года назад
We would be posting entire solutions as well
@hariharannatarajan7208
@hariharannatarajan7208 2 года назад
@@ProgrammingMadeEasy99 Nice work , Bro though.❤️
@ProgrammingMadeEasy99
@ProgrammingMadeEasy99 2 года назад
Thanks for supporting
@Abhishekkumar-pi9mu
@Abhishekkumar-pi9mu 2 года назад
Good Code is Working
@ProgrammingMadeEasy99
@ProgrammingMadeEasy99 2 года назад
Haha
@shubhamkukwas3397
@shubhamkukwas3397 2 года назад
can we do count Manually without using Inner query or aggregate query???? please reply
@ProgrammingMadeEasy99
@ProgrammingMadeEasy99 2 года назад
No
@ProgrammingMadeEasy99
@ProgrammingMadeEasy99 2 года назад
Assume the big picture let us say for 1 account you have 50000 contacts.then how would you approach that? So that's why automation is required
@shubhamkukwas3397
@shubhamkukwas3397 2 года назад
@@ProgrammingMadeEasy99 but with the help of inner Query we can get only 50000 records what about millions of records then this code will fail right?
@ProgrammingMadeEasy99
@ProgrammingMadeEasy99 2 года назад
Yes sir. That's why always try to assume the big picture as a key to scalable solution
@Abhishek-yb9kb
@Abhishek-yb9kb 2 года назад
Hello there, may i know why we are adding (Select Id from contacts) seperately in line 23, kindly guide I'm new in this domain
@ProgrammingMadeEasy99
@ProgrammingMadeEasy99 2 года назад
Hi Abhishek (Select Id from contacts) is used because we want the contacts of those accounts whose Id is present in our set. Basically this is an inner query and 1 to many relationship is being followed in here. This means that 1 account can have n number of contacts so If we want such type of thing we generally write this query. Since in here we were just concerned with the total contact size so only took Id , But if we have some other operation to do then we could have queried some other fields as last name etc all depending upon the scenario. Hope you understood. Thanks
@Abhishek-yb9kb
@Abhishek-yb9kb 2 года назад
@@ProgrammingMadeEasy99 Thank you very much bro that you gave time to reply and explained. do you teach online also
@ProgrammingMadeEasy99
@ProgrammingMadeEasy99 2 года назад
Yes bro kindly mail me at programmingmadeeasy117@gmail.com
@saurabhsp87
@saurabhsp87 2 года назад
Why are we taking newlist and oldList? kindly explain
@mr.darksoul9109
@mr.darksoul9109 Год назад
newList will contain new values and oldList will contain old values
@AnkitSharma-ok7ll
@AnkitSharma-ok7ll 2 года назад
very helpful video
@avinashtayade3718
@avinashtayade3718 2 года назад
how to create a field in account boj (total contact)
@ProgrammingMadeEasy99
@ProgrammingMadeEasy99 2 года назад
If you want to create a field you can go to setup then object manager search account and create new field. You could specify any data type for that.
@avinashtayade3718
@avinashtayade3718 2 года назад
@@ProgrammingMadeEasy99 which data type (number) or (auto number)
@ProgrammingMadeEasy99
@ProgrammingMadeEasy99 2 года назад
Number field.
@avinashtayade3718
@avinashtayade3718 2 года назад
@@ProgrammingMadeEasy99 ok sir but can you explain wich formula can use
@ProgrammingMadeEasy99
@ProgrammingMadeEasy99 2 года назад
To get total contacts associated with an account you have to use code no formula is there for it.
@TOXIC_ThakurJi
@TOXIC_ThakurJi Год назад
Can u provide us handler code?
@ProgrammingMadeEasy99
@ProgrammingMadeEasy99 Год назад
Everything is there in this video
@akshayh5795
@akshayh5795 2 года назад
Can we do this with a object with lookup relationship
@ProgrammingMadeEasy99
@ProgrammingMadeEasy99 2 года назад
Can you elaborate
@hariharannatarajan7208
@hariharannatarajan7208 2 года назад
this kinda functionality is done for look up relationships only, because in master detail relationship we have roll up summary to find the summary or count of the child records
@ProgrammingMadeEasy99
@ProgrammingMadeEasy99 2 года назад
The main aim of this video is to make you all understand how to think in Apex and moreover this is beneficial when you are giving your interviews as they generally give such type of scenarios to code in Apex.
@saiseshapu0074
@saiseshapu0074 2 года назад
Great 👍
Далее
Паук
01:01
Просмотров 2,8 млн
3d printed demon core vs real
00:24
Просмотров 7 млн
Use Salesforce Flow to count Contacts on a Account
1:59
How to fix some of the common apex errors?
16:25
Просмотров 13 тыс.
Паук
01:01
Просмотров 2,8 млн