how to debug business rule

diwakar1
Kilo Explorer

hi every one,

I am new in service now could any one let me know the best way to debug business rule in snow.

5 REPLIES 5

sergiu_panaite
ServiceNow Employee
ServiceNow Employee

There are several ways to do this, but an easy way:



- as "admin" navigate to Session Debug -> Debug Business Rule



Another way is to add gs.log statements in the BR code and they will be visible after the BR runs on logs.



Regards,


Sergiu


You can   also use


as "admin" navigate to Session Debug -> Debug Business Rule(details)


This give in detail debugging option


Govind Kumar S1
Kilo Guru

Hi Diwakar,


please go through below links :



Debugging Business Rules - ServiceNow Wiki


Debugging Tools Best Practices - ServiceNow Wiki



These links will provide you more knowledge on how to debug Business rule.



Thanks & Regards


Govind Kumar Sharma


williamsun
Mega Guru

Usually one of my last resorts when debugging any script is to run them in Background Scripts.


You do need to change some things, for example, instead of using any "current" you will need to set a GlideRecord for that table and then use that variable in place of all your current objects.


Then I add gs.print commands along the script to let me know "the script got to line 2", or "the current query contains XXX records".


Since I go step by step into the script I always am able to determine where the problem is.