Log contents of current in business rule

perkinsarm
Mega Guru

I am debugging an onBefore business rule that fires when a record is created from an external web service call and would like to see the entire contents of 'current'.

gs.info(current);

simply logs that current is an object.


How do I deserialize current so that I can see the contents?

3 REPLIES 3

Alikutty A
Tera Sage

Hi Bradley,



Use this script in a business rule as you want to deserialize the current object. Verify the logs after it is executed.



logObj(current, '*');



function logObj(obj, sep){


    for (x in obj){


          if (typeof obj[x] != "function"){


                gs.log(sep + x + ":: " + obj[x]);


          }


          logObj(obj[x], sep + "*" );


    }


}



Let me know if it works



Thanks


Please Hit like, Helpful or Correct depending on the impact of the response


It partially works. Some values are output, but warnings or errors are displayed in the log
I was hoping to get something that dumps the object in a single entry, e.g., currrent.toJSON(),   but this helped.


Jim Coyne
Kilo Patron