Get the Call Stack in a Business Rule

andymcdonald
Kilo Guru

I'm having a hard time finding the source of an update to a record.   I have identified a condition that I can use in a business rule on update of the table, and that allows me to abort the unwanted update.   However, it would really be nice if there was an API function I could call that would give me some information about the call stack at that point.   The only thing I've been able to find is GlideLog.dumpStack, but when I make that call, the result is undefined.  

There is no error at this point, so try catch is not applicable.   The goal is to know what piece of code has updated the field on the record that is creating the unwanted update.

1 ACCEPTED SOLUTION

Kalaiarasan Pus
Giga Sage

This was given by ServiceNow folks for a HI ticket raised by us recently.



try {


  throw new Packages.java.lang.Throwable();


  } catch (e) {


  gs.log(e,'change_approvers');


  gs.log(Packages.com.glide.util.Log.getStackTrace(e),'change_approvers');


  }


View solution in original post

2 REPLIES 2

Kalaiarasan Pus
Giga Sage

This was given by ServiceNow folks for a HI ticket raised by us recently.



try {


  throw new Packages.java.lang.Throwable();


  } catch (e) {


  gs.log(e,'change_approvers');


  gs.log(Packages.com.glide.util.Log.getStackTrace(e),'change_approvers');


  }



Thanks alot for sharing Kalai, this worked great and helped me identify the culprit code.



-Andy