Interested in a ServiceNow event built for developers? Registration for now[dev]26 is officially open!

Business Rule configured for Insert only runs after record update

ivettemarti
Tera Contributor

Hi everyone,

I’m having an issue with a Business Rule that is configured to run **After Insert / Update**, but it does not execute during the initial record creation.

The Business Rule has the correct table and conditions configured. However, when the record is created, the rule does not run at all — even the `gs.info()` logs at the beginning of the script are not generated.

What is strange is that once I manually update any field on the same record, the Business Rule executes correctly and the logic works as expected.

I already validated the following:

* The Business Rule is active.
* The table is correct.
* The **Insert** option is enabled.
* The configured conditions are met when the record is created.
* I temporarily tested with a very simple condition such as `Active is true`, but the Business Rule still did not execute on insert.
* There are no logs generated during the initial creation, which makes me think the Business Rule is not being triggered at all.
* Once any field is updated afterward, it executes normally.
* The same logic/code is being used in similar Business Rules for other tables, and it works correctly on insert there. The issue only happens with this specific table/process.

The record is being created through a process where some related/reference fields are populated during the creation process.

Has anyone experienced a situation where a Business Rule configured for **Insert** only starts executing after a subsequent update?

 

Any suggestions on what else I should validate would be greatly appreciated.

Thanks!

1 REPLY 1

SVimes
Mega Sage

This sounds like an order of operations issue. If submitting record 1 causes record 2 to be created, the parent field is simply null and has not been changed which means it will not trigger initially. I would have to use the workflow/logic in which I create record 2 to update record 1 with the appropriate reference to trigger the logic properly (the one case you can use current.update() in an AFTER business rule.) If I ensure that I create record 2 for referencing before submitting record 1, the conditions are certainly met.

 

I'm sure you understand this so can you walk us through the exact order of operations?

Sable Vimes - CSA | CIS-DF | CIS-ITSM