Debugging Pre Operation Plug-In Without Plug-In Trace Log
Recently, I developed a plugin which triggers on pre-operation stage. As
typical pre-operation plug-ins, the logic is to intercept the
InputParameters and modify them based on custom logic.
After deploying the plug-in to the Development environment, I just got a
generic error as below when I tested by making a change that would trigger the
plug-in. There is no arrow icon to expand for the detailed error message or no
button to download the error log either.
When I checked the Plug-In Trace Logs, there is no entry with an
exception. I updated the plug-in trace log level in System Settings to
All but there is no error message in my custom plug-in trace
either.
There is no error in the plug-in trace log because the error is in the main
operation due to invalid InputParameters after the completion of the custom
plug-in and there was no error in the pre-operation plug-in. In that case,
debugging using a plug-in profiler would not be helpful either because
the error happens after the plug-in triggers.
If you are in a similar situation as me and want to see the error message in
the main operation,
- Open the DevTools of the browser, Open the Network tab
- Clear if there are a lot of Network requests. After that, replicate the issue and click on the request (the red one) with status 403 (Forbidden) or status 500 (Internal Server Error)
- In the Response tab, for that particular request
- You will see the detailed message of the error. (In my case, setting a wrong object to the PrincipalAccess property 🤦♂️)
This method can be used to decipher some of those generic error messages
like "An error has occurred.", "You do not have {0} permission to access
{1} records.", etc. without more detailed message or a button to download the
log file. You can read more about it in
my previous blog post.
Comments
Post a Comment