"gs.info" executed by Business Rule is not displayed in application log.

Nakata1
Tera Contributor

I tried "gs.warn", "gs.error", in addition to gs.info, but no log is displayed in the application log.

Is there a solution?

1 ACCEPTED SOLUTION

So that screenshot shows the BR being an "after" BR and NOT a "display" one.  Can you please change it to "display" and then show a screenshot of the "Advanced" tab as well please.

View solution in original post

20 REPLIES 20

Can you add a screenshot of the top part of the Business Rule itself?  I just want to make sure it is indeed active AND running on the Incident table.

Also, it looks like you've completely changed the structure of the code itself (which is why it's not running I believe).  The default code should look something like this:

(function executeRule(current, previous /*null when async*/) {

	// Add your code here

})(current, previous);

So your code should look something like this:

(function executeRule(current, previous /*null when async*/ ) {
    gs.info("JC - Finally running!!!");

    var total = 0;
    var gr = new GlideRecord('task_time_worked'); //related list table name
    gr.addQuery("task", current.getValue('sys_id'));
    gr.query();
    while (gr.next()) {
        total += gr.time_worked.dateNumericValue();
    }
    current.u_total_time_worked.setDateNumericValue(total);
})(current, previous);

I changed your query so that it's looking at the "task" field and not "incident".  So if we got the BR working (and I think it finally will), you would have ended up calculating time worked for ALL Tasks!!!!!  And is the field name you want to update called "u_total_time_worked" or "total_time_worked" without the "u_" prefix?

a screenshot of the top part of the Business Rule

find_real_file.png

sys_dictionary "u_total_time_worked"

find_real_file.png

I tried the modified script but it didn't work. No logs were displayed. Is BR not performing well?

So that screenshot shows the BR being an "after" BR and NOT a "display" one.  Can you please change it to "display" and then show a screenshot of the "Advanced" tab as well please.

Changing BR to "after" solved the problem. Thank you very much.

Hello...can you clarify what was the correct answer. Just for future readers?

Your BR was already an after and Jim was asking for you to change it to something else...then you replied and said changing it to after worked.

What was the solution then?


Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!