+ Start a Discussion

Urgent: Cloud Swarm: validation error apex trigger opptySwarm caused an unexpected exception

It happens when user rejects an opportunity approval request.




This image is not available because: You don’t have the privileges to see it, or it has been removed from the system


This is a question of having too many SOQL queries as part of the trigger.  I'm guessing that you have a non-Chatter Swarm trigger operating as well and it is using some SOQL queries as part of this.  IIRC, ChatterSwarm is fairly optimized for queries but does still use several.  You might need to take a detailed look at the code to see which apps are using how many queries and adjust your code.




I run the test and this is the result:



Test ClassCaseSwarmTest
Tests Run6
Test Failures5
Code Coverage Total %42
Total Time (ms)113870.0

I dont know how to troubleshoot this, maybe I will delete it.


Tests can fail for a few reasons.  Many times Apex tests fail b/c they create sample data which doesn't match the orgs validation rules.  This might be true here.  So, for example, if you require some field on your opportunity and have a custom validation rule configured, that can cause the Apex Test to fail.


You can actually create a log of your app which will tell you -- in great detail -- what is happening, what processes are using how many SOQL queries, etc.  Search Help under "system log" for details.


Make sure that you have feed tracking for Opportunities and Cases.  To do this, go to Setup | App Setup | Customize | Chatter | Feed Tracking and for Cases and Opportunities make sure to check "Enable Feed Tracking" and save.