VVpackers
2 years agoNew Contributor
how to debug a business rule
An allocation business rule is not allocating the rates properly . Hence we would like to debug the business rule and also figure out which intersections are passed and what is the value and allocation rate used in allocation calculation .
This allocation process involves a formula in UD7 member .
Please advise how to see the messages used in api.logmessage . Should we need to create a dashboard to capture the messages that are logged while running the allocations. Again, we are looking for which members used and the value / rate used to allocate.
VVpackersYou can use the below methodology to start debugging your rule. I have read the below tip from this community.
1) Simplifying Log Message Define a Boolean Constant LogSwitch Public Const LogSwitch As Boolean = True True- To turn on logging for your business rule False - To turn off logging for your business rule Use the below statement when writing a log If LogSwitch = True Then brapi.ErrorLog.LogMessage(si, "My Workflow name is " &Workflow ) Also, To Log everything in a single string use the below format - Dim log As String = String.Empty 'Append to “log” throughout business rule log += “Message 1” & VbCrLf '<— VbCrLf is a .Net constant for “New Line” log += “Message 2” & VbCrLf 'At the very end of Business Rule I write the log variable to the ErrorLog. BRApi.ErrorLog.LogMessage(si, log)