Business Rule Troubleshooting

jamess_
Tera Contributor

I have a 3rd party Integration that writes to custom fields in Incident Management. I then have BRs that monitor those fields and make appropriate adjustments to the (native) Incident fields, based on our internal requirements. Most work very well.

One such rule, however, is set up to monitor the 3rd Party's "Status", and when they set to "Closed", we set our Incident to "Resolved". Is is configured to run After Update, and is the highest Order number for the Incident Table running After update.

I have a log message to verify the script is activating within seconds of the 3rd Party updating the monitored field, but the other fields I'm attempting to change with the BR are not updating.

If I use the same statements in a Background Script interactively, the Incidents update normally, although I do receive some alerts on other slow business rules). While I know how to turn on BR Debugging, it doesn't seem like I would receive any information from this because I'm not the one updating the Incident record. How do I catch whatever is going wrong when the BR attempts to set these field values (after the fact).

Business Rule Script:

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

gs.info('Business rule ********** started for Incident ' + current.number);

current.state = 6;
current.closed_at = current.u_custom_closed_date;
current.u_actual_resolution = current.u_custom_closed_date;
current.close_notes = 'Closed by Custom NOC';
current.u_major_system = 'Network';
current.u_category = 'Network System Issues';
})(current, previous);

1 ACCEPTED SOLUTION

The reason I asked this question is because, you will have to switch the BR to Before business rule. Changes made in before Business Rules are automatically saved when all before Business Rules are complete, and after Business Rules are best used for updating related, not current, objects

 

Thanks,

Pradeep Sharma

View solution in original post

11 REPLIES 11

That was added when the state wasn't changing as I desperately sought out what I expected to be a mandatory field stopping me from updating State. I've commented it out.

Now that makes sense. I'm trying that now. So, if there had been an error, would it have shown up in the System Log?

Yes, an error should have shown up in the logs.

The reason I asked this question is because, you will have to switch the BR to Before business rule. Changes made in before Business Rules are automatically saved when all before Business Rules are complete, and after Business Rules are best used for updating related, not current, objects

 

Thanks,

Pradeep Sharma

ndt13
Giga Expert

Do you have any other business rules or data policies configured that require 'state' to be mandatory before updating the record?  What happens to the record if you remove (or comment out) the line that contains current.state = 6?