apex – Governance Limit per Transaction : How is it counted ? 101 SOQL executed Error
I have an LWC (which performs searches and allows a User to move records between 2 Master records). When User clicks on Finish button on LWC, then
- it calls an Aura Enabled Apex method (identifyA),and decides what needs to be done as part of movement of slave record(s) between the 2 Master records, and it creates a record of these movements in a custom object (customObj1)
- There is a trigger written on the customObj1, which actually carries out the actualy movement that was identified in above step.
Problem: I keep hitting governance limit 101 SOQL executed.
- What I need to understand is when does the transaction begins ? (so that I can understand from logs which queries are getting considered which causes 101 governance error)
1.1) Is it when I click Finish button and once a request goes to the server to execite apex server side code ?
1.2) Is it after I insert a new record and after that point all SOQLs are considered ? - OR does this transaction also considers all the SOQL fired under method identifyA as well ?
Basically, when does Apex consider a transaction has begun and it starts to count of SOQL executed ?
Also I added in my code to print in the log the current query count, and there it says it has a limit of 300, why and how is that ?
Please let me know in case there are queries and I will answer them.
Read more here: Source link