Тёмный

Salesforce Coding Interview with Salesforce MVP | Part 2 | By Salesforce Engineer 

SFDCFacts Academy
Подписаться 48 тыс.
Просмотров 26 тыс.
50% 1

In this video, I conduct a mock Salesforce Coding and Admin interview with Salesforce MVP, Narender Singh. I have conducted many interviews for Salesforce in the past 3 years and you will get to feel a real interview setup in this video. Most of product tech companies follow similar interview pattern.
Checkout part1 of this interview here: • Salesforce Admin Inter...
Follow Narender on twitter @Nads_P07
Become a patron and support my work here: / sfdcfacts
Please share this video and subscribe to the channel if you love my content.
Content By: Manish Choudhari
Editor: Manish Choudhari
Website: sfdcfacts.com
Twitter: / manish_sfdc
LinkedIn: / manish-choudhary

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

 

28 сен 2024

Поделиться:

Ссылка:

Скачать:

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

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 90   
@SFDCFacts
@SFDCFacts 4 года назад
****FREE LWC COURSE VOUCHER***** Are you someone or do you know someone who recently appeared for a Salesforce Developer interview at Google/Amazon/Uber/Salesforce or any major product company? Then reach out to me at *sfdcfacts@**gmail.com* to share your interview experience and get access to LWC udemy course for FREE!!!!!
@gaurichaudhari1201
@gaurichaudhari1201 2 года назад
Good Interview. I tried and tested. I wrote same trigger with same handler class. I inserted 1000 records, for first batch the values are true. 1-200 true. all the batches after that are false. hence 1st true 50th true 100th true 201st false 250th false 500th false 1000th false
@lokeshkumar3163
@lokeshkumar3163 4 года назад
Point is the static variable maintain it states throughout the transaction until you set another value. The Batch size is 1000 so all updates will be synchronous and there will be only one batch thread of size 1000. Trigger consider a batch of 200 records and process it synchronously, in this case, the processing will be divided in 1000/200 = 5 and from 1st record till 200th the value will be true and after that, the value will be set to false due to the condition written outside the loop and once it is set to false it remains same until it is updated so for all the other from 201 -1000 records the value will be False. I hope it explains the answer in detail. 1st true 50th true 100th true 201st false 250th false 500th false 1000th false
@SFDCFacts
@SFDCFacts 4 года назад
Correct :)
@Psychologyfacts541
@Psychologyfacts541 4 года назад
So sir, is it possible at 400 =false and 401=true right 500 = true
@anuragnarang26
@anuragnarang26 3 года назад
U sure? Doesn't it depends on database.stateful? If its implemented or not.
@KapasiTejasVideos
@KapasiTejasVideos 3 года назад
@@anuragnarang26 use database.stateful if you want to maintain the state of any local batch variable across the batch transactions. Here it's more about Trigger context because batch execution method is trying to insert 1000 contacts which basically fires the trigger and hence Database. stateful not relevant here.
@ourmoments7800
@ourmoments7800 3 года назад
I have a question. As you rightly said the trigger will consider it as 5 chunks each consisting of 200 records. But my doubt is will it be 5 different transactions as the trigger logic will be executed 5 times for each chunks. If that's the case then the static variable will be initialised 5 times right? Or is it like it will be a single transaction wherein chunk 1 processed synchronisly, and then chunk 2 records processed synchronisly and so on. In short is it 5 transaction or just 1? Any help would mean alot
@nandkishornaikwadi8377
@nandkishornaikwadi8377 4 года назад
All debug commands will print true, As each for loop works for batch size and after completing for loop of that batch it sets variable to false(which will be never printed), for next batch variable is again initialised to true and it will print true for complete batch. The same logic will repeat for each batch. Kindly correct me @manish if i'm forgetting something ! You are doing a great job 👍
@SFDCFacts
@SFDCFacts 4 года назад
Incorrect Nandkishor, give it another try. 🙂
@nandkishornaikwadi8377
@nandkishornaikwadi8377 4 года назад
@@SFDCFacts according to my knowledge it completely depends upon batch size which we define in executeBatch statement. Here you haven't mentioned anything about it, so i considered default batch size of 200. In this case each debug statement will print TRUE. If we define batch size equal to 1000, then upto 200 it will print TRUE(as trigger will process 200 records at a time) and after that for remaining records it will print FALSE. Hopefully i'm approaching it right 😀
@SFDCFacts
@SFDCFacts 4 года назад
I did mention about the batch size if you listen to the video, it is 1000. 😊
@nandkishornaikwadi8377
@nandkishornaikwadi8377 4 года назад
@@SFDCFacts oh! I completely missed it ! Thanks for correction 👍 If batch size is 1000, then for first 200 debug statements it will print TRUE and after that it will print FALSE for every debug statement.
@vinodazure2676
@vinodazure2676 4 года назад
Feel like this bro is doing more over Action than answering the manish questions. 🤣🤣🤣 seems I understand manishs bhai inner feeling
@ArunKumar-hp8ue
@ArunKumar-hp8ue 4 года назад
Hi Manish, Great work from your side, it will help for sa many people to get some info👍🤝 Answer for the 1st question is: As you mentioned batch size is 1000, so far myvar also static variable because for entire transaction will run in only one batch and update true for all. Thank you
@SFDCFacts
@SFDCFacts 4 года назад
Incorrect, give it another try.
@heenaanif348
@heenaanif348 4 года назад
Thank you Manish 🙃 your video is really helpful. I m going to share this video in my college for my junior's. 🍬 Chocolate for you...... for this video.
@rameshgoud4970
@rameshgoud4970 4 года назад
Great session...The answer should be 1st record update: true 50th record update: true 100th record update: true 250th record update: false 500th record update: false 1000th record update: false only for first 200 records the value of static variable will be true after that it set to false ,then for remaining records (201 to 1000) it will be false. Please correct me if am wrong.
@AnuragDhaka
@AnuragDhaka 2 года назад
Just tested this logic , with every chunk or batch size its new transaction and static variable will be reset , ie if it 1000 record and batch size is 200 then 1st 200 will be execute as one transaction and then next 201 to 400 will be in another transaction , this is how batch is avoiding platform limits every batch is separate transaction so in this scenario it will be true for all given 1st ,50th, 200, 201st , 500 because at then end of for loop it sets to false but in next transaction it get reset back to true
@crazyboys7301
@crazyboys7301 4 года назад
1st true 50th true 100th true 250th true 500th true 1000th false
@SFDCFacts
@SFDCFacts 4 года назад
Incorrect, give it another try.
@kolliramu546
@kolliramu546 4 года назад
@@SFDCFacts It will be 'true' for all iterations.
@nareshs4748
@nareshs4748 4 года назад
Good one Manish , was that guy really MVP What is qualification for MVP .. no need of practical knowledge ? .. These are some basic day to day stuff for hard core SFDC developers
@harshasuman2369
@harshasuman2369 4 года назад
Hello Mainsh, These videos interviews were really great. I do have experience few interviews and everyone is asking scenario based questions like you framed in your videos, can you help with more videos like that and also if you could suggest where do I practice more of these scenario based questions as mostly in google I am getting theory questions. Thanks!!
@SFDCFacts
@SFDCFacts 3 года назад
Noted, sure
@pkcreations6034
@pkcreations6034 4 года назад
This is amazing , lots of learning on single video and it's interesting. Much appreciated . Please do more.
@kavitaupadhyaya4814
@kavitaupadhyaya4814 Год назад
1 true 50 true 100 true 201 false 250 false 500 false 1000 false Please correct me if I'm wrong
@shoottkuruvi9856
@shoottkuruvi9856 4 года назад
Thanks for this Manish. As per my understanding of the concept, for the first transaction the variable value will be true, once the chunk is processed and from the second chunk the value will be false because it was initialized only once......for making all the chunks to print as true what should be the approach, please give ur thoughts on this.....
@AshwaniKumar-bf4vj
@AshwaniKumar-bf4vj 4 года назад
Trigger.new will hold the batch of 200 records so it maked 5 threads of 1000 records. Since myVar is static variable it will hold its state across transaction. Chunks of records and myVar value: 1-200(true) 201-399(false) 400-600(false) 601-799(false) 800-1000(false)
@ramangandhi4221
@ramangandhi4221 4 года назад
1st record updates : true 50 record updates : true 100 record updates : true 201 record updates : true 250 record updates : true 500 record updates : true 1000 record updates : true myVar will be true each time. This is because you did not implement the Database.Stateful interface in your class, meaning variable states are not kept from one scope to another Manish please reply
@vijayv3770
@vijayv3770 2 года назад
I have tried the same code for 440 records and Value of variable is always true.
@dipenshah1393
@dipenshah1393 4 года назад
Being MVP doesn’t make you expert
@abcshohag
@abcshohag 3 года назад
The purpose of this video was to share some knowledge to the audience, not to compare their expertise.
@revathyharidas3950
@revathyharidas3950 4 года назад
For the question related to updating 1000 contacts, I don't see how that static variable is affecting the data update. I tried the same code snippet in my dev org and inserted all 1000 records and updated the email for all records to empty. The static variable becomes false after the first instance of the trigger but there is no condition check using that before email field update so why 201 st record will fail ????
@bratatibarman9963
@bratatibarman9963 4 года назад
Hi Revathy I am started learning Salesforce by my own...by watching vedios and through the trailhead...but want some guidance as well. Specially for interview preparation... I want guidance from someone who is wory in Salesforce. I think u r working in this field. Could you please help me in this?? It will be really grateful for me...I can share my mail id for further discussion if you want..plz help
@revathyharidas3950
@revathyharidas3950 4 года назад
@@bratatibarman9963 Bratati, I think you are on the right track by following tutorial videos and trailhead. Try to work on the projects and super badges available in the trailhead that way you will get hands-on experience. And go through the salesforce documentation like Apex doc, lightning etc. Try to implement in developer org while you learn, be it configuration part or customization. Hope this helps, best of luck :)
@bratatibarman9963
@bratatibarman9963 4 года назад
@@revathyharidas3950 thanks for the info 👍
@kd-1-9942
@kd-1-9942 Год назад
Because 1st batch of 200 gets finished. For second batch it will call that method again but will not reinitiate static variables.
@phabove7
@phabove7 3 года назад
I don't know if my approach makes sense, but I would choose between "After Update" and "Before Update" events based on how important it is to complete "Account Update" operation vs "Task creation". Let's say, Task creation is so crucial that Account shouldn't be updated without it. Then, I would go for "Before Update", because if "Insert Tasks" DML fails, the transaction should be terminated. But, for most practical reasons, Account update does a lot more job and it shouldn't be dependent on Task creation. In that case, we may go for "After Update", with Exception Handling for "Insert Tasks" DML.
@nagendrasingh228
@nagendrasingh228 4 года назад
1st true 50th true 100th true 250th false 500th false 1000th false
@dkhatri1994
@dkhatri1994 4 года назад
Yes, batch size play the role, how may records come in trigger. But the main thing is that. Below 200 can only work in that case. If you give batch size more than 200, then trigger will run in 200 chunks and if you give below 200. Like 100 then trigger will run in 100 records chunk.
@dkhatri1994
@dkhatri1994 4 года назад
Correct answer.
@manj3125
@manj3125 4 года назад
For the question on before and after trigger, since it is update operation it will work in before trigger also because the account ID is already present, but if it was insert operation it would not work.
@qarora
@qarora Год назад
basically Batch begins the transaction .. Now, it passes chunks of 200 records each time while processing the records i.e., execute method. Now, since the DML would be in execute method, the trigger will be invoked 5 times in this particulr scenario. Now comes the tricky part, trigger's handler would also be called 5times so it would initialise the value of the variable 5times. Note that the variable itself is static but it is not in the context of the separate transaction that batch's current chunk has created, so it will reset after 200records. Hence, 1-199 - TRUE 200 - FALSE 201-399 - TRUE 400 - FALSE 401-599- TRUE ...
@TheBeastBananas
@TheBeastBananas 9 месяцев назад
WhoId instead of ownerId for Tasks
@manj3125
@manj3125 4 года назад
For Creating Tasks and Events - use WhatID and WhoID based on the respective object.
@Magical_Souls
@Magical_Souls 2 года назад
For assigning inserted account record id to what Id we have to choose " After Update" , record id value won't be available for 'before insert
@amithajare6039
@amithajare6039 4 года назад
Thank you Manish both the parts were really good. I have a question is there any source to learn and improve time and space complexities?!
@SFDCFacts
@SFDCFacts 4 года назад
Yes, lost of them. Try searching big O notation on google/youtube and you will get plenty of results.
@rushikeshmane2297
@rushikeshmane2297 Год назад
really helpfull Manish🤩please add more to this playlist..thanks
@ameensams
@ameensams 4 года назад
Because you are referencing an Id field which will not be set until the record has been created, using a before trigger event will not work.
@santoshparit1244
@santoshparit1244 2 года назад
This is amazing , lots of learning on single video and it's interesting. Much appreciated .
@monstersid
@monstersid 4 года назад
For the batch question: 1st record update: True 50th record update: True 100th record update: True 250th record update: False 500th record update: False 1000th record update: False Anything after 200 for that matter would be false as the static variable context would be maintained and as Narendar already mentioned, trigger would run in batches of 200 even though you are running the batch class with a batch size of 1000.
@nigamgoyal
@nigamgoyal 4 года назад
I go forward with this answer
@chrisludovice07
@chrisludovice07 4 года назад
given if the job maintain its state. You can use Database.Stateful in your batch code.
@HVadlamudi
@HVadlamudi 2 года назад
Thanks for the trigger.oldMap on if condition that i never tried before.
@saurabhsood007
@saurabhsood007 4 года назад
Hi Manish : Below are my answers why true because it take 200 records in one batch and for loop run 200 times update static variable to false but again new batch of records come and static variable update to true for next instance of batch so answer are :) This answer will be true if code is written in trigger itself not in handler. 1st true 50 true 100 true 250 true 500 true 1000 true Let me know you thoughts ..
@SFDCFacts
@SFDCFacts 4 года назад
Incorrect answer 😜 give it another look.
@saurabhsood007
@saurabhsood007 4 года назад
@@SFDCFacts : My Bad, if we have handler class that time results would be different Static Initialization will happen only once when class is get initialized i.e. public static Boolean myVar = true; Once first batch of 200 got executed, myVar get updated to myVar = false and class will not get initialized again !! Because already initialized for first chunk of records After that it will print false value. :) 1st true 50 true 100 true 250 false 500 false 1000 false Thanks for your response.... please give your thoughts once again !! :)
@chatoanil
@chatoanil 4 года назад
Thank u Manish.
@meenakshipochincharla8714
@meenakshipochincharla8714 4 года назад
Hi Manish, Great work, Please post more questions on trigger-based scenarios
@shubhamdhupar523
@shubhamdhupar523 4 года назад
The new task apex code will work well on before update but if the conditions were different and we had to implement for INSERT as well, it won't work on BEFORE INSERT because no commit would have taken place and we won't have an account Id to associate with the task. The question to use before or after suits better when dealing with Insert
@aamirahmad5817
@aamirahmad5817 4 года назад
and also old and oldMap are not available in an insert context, so it would give an error
@divyaagarwal6844
@divyaagarwal6844 4 года назад
Good stuff Manish. Would be helpful if you add more questions based on trigger scenarios,order of execution scenarios
@nani1385
@nani1385 4 года назад
1st true 50th true 100th true 250th true 500th true 1000th true
@ujjawalverma2260
@ujjawalverma2260 4 года назад
What was the answer of first question ?
@SFDCFacts
@SFDCFacts 4 года назад
Think about it 🙃 what do you think should be the answer?
@tharuniganesh
@tharuniganesh 3 года назад
We need answers for all questions
@biswajitsamantaray3117
@biswajitsamantaray3117 3 года назад
Hi friend, Can I be part of your Interview please
@SFDCFacts
@SFDCFacts 3 года назад
Hi Biswajit, contact me at sfdcfacts@gmail.com
@alliabutool1716
@alliabutool1716 3 года назад
Hi Manish.. Give some more trigger based questions as they asked this more
@SFDCFacts
@SFDCFacts 3 года назад
first someone has to agree for an interview with me :D people do not want to be interviewed, kudos to Narender and Ranjan who had the confidence to come live with and give interview.
@anshulmore
@anshulmore 3 года назад
@@SFDCFacts I have been learning salesforce for past 6 months now ON and OFF bcz on current office work. I would be glad if you could evaluate me on ADMIN, APEX, AURA, LWC. May be offline.
@51madan
@51madan 4 года назад
true entire outputs
@sflearner9388
@sflearner9388 4 года назад
Hi Manish : for the 1st question I believe it will run in batches of 200, once the 200th record iteration is done, as per save order , another chunk will process but since the static variable value is now false, so , after 200th record it will always be false in that scope. 1st true 50 true 100 true 250 false 500 false 1000 false I may be wrong,so, when we will be getting the answer and explanation too, for the same. thanks @nads @manish for amazing video
@crazyboys7301
@crazyboys7301 4 года назад
He said batch size is 1000
@chrisludovice07
@chrisludovice07 4 года назад
On the first problem, if the batch size is 1000 then it would definitely print 1000 TRUEs since it will all be checked inside the LOOP even if the batch job maintain its state (Database.Stateful). Every transaction is discrete and each chunk the state of the job is reset. But if the batch size is
@manj3125
@manj3125 4 года назад
Hi Manish, I think it should be the below answer. Could you please verify the answer ? at least secretly :) True True True False False False
@NarenderSingh-tq1wq
@NarenderSingh-tq1wq 4 года назад
Yeah, that should be the answer. The reason I messed up was because I completely misread the question and didn't see that the condition was outside for loop. 😅
@manj3125
@manj3125 4 года назад
@@NarenderSingh-tq1wq thanks bro. Your approach on using a single automation tool made a lot of sense. Cheers for that!!
@sidhantgupta7811
@sidhantgupta7811 4 года назад
1st true 50 true 100 true 250 false 500 true 1000 true
@SFDCFacts
@SFDCFacts 4 года назад
Incorrect, give it another try.
@ujjawalverma2260
@ujjawalverma2260 4 года назад
All are false except firstone
@SFDCFacts
@SFDCFacts 4 года назад
Incorrect answer 🙂 give it another look.
@SFDCFacts
@SFDCFacts 4 года назад
@@starman9000 Incorrect, give it another try.
@balamuruganvelu976
@balamuruganvelu976 4 года назад
@@starman9000 on 1000th iteration, the counter value is 1001, and exits the loop with MyVar as 'true' the if loop evaluates MyVar true and sets MyVar to 'false' and prints the value as false.
Далее