Hi Sir, In this trigger if we do not update any field, just click on edit button and then clicked on save still it is updating the stageName, what will be the condition we have to avoid this? Thank you.
I have iterated over opportunity records, Select id, stagename, accountId, createdDate where accountId IN: trigger.newMap.keySet() Inside for loop, Checked the time and stagename, then updated the stage Is it good approach ???
Hello Abhishek, Thank you for your valuable comment and suggestion regarding the code. I appreciate your insight on optimizing the code by reducing the number of queries. I completely understand your point. However, it's important to consider that there might be various requirements or modifications in the requirement. That's why I have implemented the filter condition in line 27 to accommodate such potential changes. I hope this clarifies the reasoning behind my approach. Please let me know if you have any further suggestions or if there's anything else I can assist you with.
Got the below error accTrigger: execution of AfterUpdate caused by: System.DmlException: Update failed. First exception on row 0 with id 0065g00000YPTm9AAH; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, oppTrigger: maximum trigger depth exceeded Account trigger event
Hi Sir, In this trigger if we do not update any field, just click on edit button and then clicked on save still it is updating the stageName, what will be the condition we have to avoid this? Thank you.
I have iterated over opportunity records,
Select id, stagename, accountId, createdDate where accountId IN: trigger.newMap.keySet()
Inside for loop,
Checked the time and stagename, then updated the stage
Is it good approach ???
Hi, I have a question. How are you populating custom creater date field which you have created?
GO TO -> object manager->Opportunity->New field->Test Created date->datataype=date->save
Can't we write the line 27's filter condition in the SOQL query itself?
Hello Abhishek,
Thank you for your valuable comment and suggestion regarding the code. I appreciate your insight on optimizing the code by reducing the number of queries. I completely understand your point. However, it's important to consider that there might be various requirements or modifications in the requirement. That's why I have implemented the filter condition in line 27 to accommodate such potential changes.
I hope this clarifies the reasoning behind my approach. Please let me know if you have any further suggestions or if there's anything else I can assist you with.
Got the below error
accTrigger: execution of AfterUpdate caused by: System.DmlException: Update failed. First exception on row 0 with id 0065g00000YPTm9AAH; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, oppTrigger: maximum trigger depth exceeded Account trigger event
Deactivate oppTrigger
Recursive trigger problem.
you have reached the end of heap size, so check in your previous triggers where it is going in loops
Hi,thanks for Sharing the senarios...it helps me a lot .
Can u make Vedios on test classes.
Thanks.
sure i have test classes in my plan
Can't we use standard field created in query??
We can use it and for testing purpose we can use Test.setCreatedDate(recordId,date) in apex testing