Better Way to Debug Business Rules

jmiskey
Kilo Sage

We have a situation where in Workflow Designer, when we create a new workflow, it is set up with the following "default" stages.

 

jmiskey_0-1674765100214.png

Notice the format of the value for the "Request Cancelled" Stage.  It does not follow good programming practices, in that it has a space in, where the others use an underscore instead.  So we updated it so that the default value for new workflows is now set to "request_cancelled".

 

We have various Business Rules that close out the parent REQ with all the child RITMs are closed.  I thought that I amended all the necessary Business Rules, but apparently not, because it is not working properly.  When I cancel the RITM and this stage is updated, the parent REQ is no longer closing.  So I apparently missed one of the Business Rules in my update (note that if I use the old value of "Requested  Cancelled", it DOES successfully close out the parent REQ).

 

So, I tried running some tests, using the old way and the new way to see if I could find the difference.  I tried using the built-in Business Rule Debugger, but find it very cumbersome to sift through.  There are literally hundreds (if not thousands) of lines it returns, and trying to sift through it to get any sort of useful information is very difficult.  All I really want to know is:

1. What Business Rules were triggered

2. What they changed/updated

 

The 2nd part isn't even really necessary (though it would be nice and make this task much easier).

 

Does anyone know of a better/more efficient way of solving of debugging Business Rules/solving this issue?

 

I should probably also ask, is there anything other than a Business Rule that could be doing this (perhaps I am looking in the wrong place).

 

Thanks

3 REPLIES 3

Brad Bowman
Kilo Patron
Kilo Patron

If you've searched/replaced the value in the script field on all business rules, it's likely in a Script Include called by a Business Rule.  You can do the same search from a list view of all Script Includes, or better yet get FetchCode from the Share site to search for this value across most scripts, etc.

https://developer.servicenow.com/connect.do#!/share/contents/1176688_fetchcode_an_instance_code_sear... 

Thanks Brad!  That trick about searching the Script field on the Business Rule and Script Includes table is very helpful (I don't know why I didn't think of that).

I see some Script Includes, which are Read-Only, reference the old format.  I am now thinking rather than trying to update all the different places where "Request Cancelled" is referenced to "request_cancelled", it would be better to let it be.

 

However, at some point not so long ago, we managed to change the Default Stages that in new workflows to use "request_cancelled" instead of "Request Cancelled".  I would like to set that default back so that all of our new workflows use the "Request Cancelled" version that most of our Business Rules and Client Scripts reference.  However, I cannot see to find the right table.  I looked at "wf_stage" and "wf_stage_default", but neither of those seem to be the correct one.  Would you happen to have any idea where the default stages that are used in new workflows is stored?

Thanks

I found the answer to my question regarding where those default stages are stored.

You have to go to Workflow --> Default Stages (by table)

 

So I set the value back to what it was, so this problem won't occur on new workflows.  Might need to fix some of the old ones that used this other version.