A while ago I was looking at standardising some of the debugging information applications I wrote would output, and on a reasonably regular basis I’d want to verify data my code was passing to APIs, especially if there was an error on the call.
It was during the search that I came across the ToLogString() method on the MIRecord.
When I get an error from the APIs, I’ll output the what was passed in on the MIRequest via MIRequest.Record.ToLogString(), it will provide useful output like we see below
As you can see with the CUSEXTMI.ChgFieldValue it’s not providing much helpful information on which field it errored on, but I output the Record.ToLogString() I can see what data I passed to the APIs and in this instance it’s pretty obvious the bad value.
Very handy!