You need to sign in to do that
Don't have an account?
pradsy90
Debugging Validations
Hi -
Is there a way to debug our code. I have a validation which passed the syntax test but it not giving me the right result.
I would like to know what values are being passed to the rule and how it is interpreting them.
So, is there a way to debug this validation during runtime? I am new to Force.Com and am finding my way through this stuff.
Such tools are commonly available in Eclipse IDE, Visual Studio. Just wondering.
Any help is appreciated and thanks for your time.
Regards,
Hi,
You can use debug log to debug your code. Goto Setup--> Administration Setup--> Monitoring-->Debug logs--> Click on New Button ---> click on lookup icon--> select logged in user from list -->click save.
Now execute your code and go to that debug log page, you would find a entry log entry against your execution. Now click on view link--> here you can view all details of execution.
All Answers
Hi,
You can use debug log to debug your code. Goto Setup--> Administration Setup--> Monitoring-->Debug logs--> Click on New Button ---> click on lookup icon--> select logged in user from list -->click save.
Now execute your code and go to that debug log page, you would find a entry log entry against your execution. Now click on view link--> here you can view all details of execution.
Hi,
For debugging validations code you have to go in 'System Debug (Developer Console ) or Debug Logs'.
1 - For System Debug (Developer Console ) go to Name-->System Debug (Developer Console )
2 - For Debug Logs go to name--->setup--->Administration Setup--->Monitoring--->Debug Logs
Alok -
Thanks for this information and THANKS FOR YOUR TIME :).
This helped. I was create my user for logging and then look at the logs everytime I created a record or updated a record whIch went through these validations.
However, these were after the fact. Meaning the system had finished what it was doing. I was looking for a run time line by line debug where I can look at the flow of the code as and when it happens.
In my specific example I was using the PREVIOUSVALUE function on a field and then checking if it was greater than a specific value. I waned to know exactly what was the system passing for PREVIOUSVALUE. I could not get it. The logs only had the current value of the column. But never the previous value. In an ideal world a real time debugger would be able to provide these values where you can find exactly why your code is behaving the way it is behaving.
Regards,
Ankit -
I tried the option 1 which is to go to the MyName -> Developer Console -> Logs. I set my validation for rule to be the finest. Everytime the validation rule ran I got a log file.
But it looked the same as option 2 which is go to Administration SetUp-> Monitoring -> Debug Logs.
So, I guess my question is is there a difference between the two options or is it two diff ways to get to the log file?
Regards,
Hello,
In developer console and debug log, mainly difference are :
1- debug log work on user login its means it work for a single user at a time but developer console work on system mode its give you details all code execution view.
2- In developer console you can write Apex code or soql query and execute but in debug log you can't.
Thanks