Debugging business rule

habin
Kilo Contributor

Hi,
I need to debug a business rule.I have written the following code inside the business rule by referring http://wiki.service-now.com/index.phptitle=Alert,_Info,_and_Error_Message_Scripts#Business_rule_and_other_general_use

[... some code...]
gs.addInfoMessage("Hello World");
gs.print("Hello World");
gs.log("Hello World");
[... some code...]
The business rule runs successfully and does the intended tasks. but I cant find the messages I gave inside the code.(ie. 'Hello World' in this case).

1 . I have searched System Log --->ALL --->Message.
2. addInfoMessage is intended to put a message on the top of the screen but didn't get any message.

Please reply back if you have any knowledge about the same.

Thanks in advance.
Habin

6 REPLIES 6

john_roberts
Mega Guru

Check the system log for errors. Sounds like your script crashed or ended before your output commands.


I just need to know where I can find the messages when my code contains

gs.addInfoMessage("Hello World");
gs.print("Hello World");
gs.log("Hello World");

I'm not able to debug my code, as I not able to see the output of the above codes.It will be a great help if you please tell how can I get the same.

Do I need to search in some directories, tables,etc or need to do any configuration ?


* addInfoMessage will display at the top of the form or list on next load after server script is executed
* print will only display if you enable the module "Debug Log", message will display at bottom of form/list
* log will write to system log with a source of "*** Script"

You can also enable the "Debug Business Rules" to display the list of rules executed and "Debug Business Rule (Details)" to show field changes from business rules.

Lastly you can enable the "JS Debug Activate" to display every line of evaluated code from business rules.

Hope that helps.


Thanks John.The info is useful. 🙂
One more quick question.
Does service-now provides any UI (like sql developer,toad) where I can execute queries and see the results ?