Just a quick one.
Just now I receive this error from my triggered custom plugin:
"There is no active transaction. This error is usually caused by custom plug-ins that ignore errors from service calls and continue processing."
And I believe that this often happen to the development.
Root Cause
Here is the root cause:1. I have a custom plugin in the onCreate event.
2. Inside my custom plugin, I have Assign function
3. I try to put ‘try and catch’ just to avoid the error
4. Then it hits another error which is: “There is no active transaction. This error is usually caused by custom plug-ins that ignore errors from service calls and continue processing.”
5. So, I put a logger
6. And I have this error, instead:
Which this error is actually CRM System Error:
SecLib::CrmCheckPrivilege failed. Returned hr = -2147220943 on UserId: 01dc8c30-eb68-e511-80f2-00155dad0019 and PrivilegeType: ReadSo, my conclusion:
Conclusion
1. My Team/User that I want to assign to does not have Any Security Role that having this Read privilege for the entity record object i want to assign to.2. I try to skip the CRM Error by putting the try and catch just before the ‘Assign’ request
3. But, it fails to proceed, instead, CRM still insists to block this creation..
4. Because it is also right, you cannot do it anyway, CRM system plugin would still block and there is no way you skip the process that needs another rule to apply.
5. Eventhough i put this try catch and try to cancel the Assignment, I still receive the error:
What to Check
So, if you find this error, please check:- Whether you have custom plugin/custom workflow active triggered
- Whether you put skipping the error that will have impact to the CRM process, it is not possible
- Actually you better to log the error
- Because you won’t know what it is
- This is not your logic wrong in your custom plugin
- This just you need to fix why CRM cannot proceed?
- Is that because your user/team does not have privilege or you missed some parameters required
- This error might happen like for Assignment, Lead Qualification, Quote creation, etc
Hope this helps.