Before Update BR not working as expected

MHimabindu
Tera Contributor

Hello Community,

 

I’m facing an issue with a custom Business Rule on the Requested Item (RITM) table and would appreciate your guidance.

I have a Before Update Business Rule that executes when the RITM state changes to Fulfilled. The purpose of this rule is to populate a custom Date/Time field using gs.nowDateTime();

The Business Rule works as expected for most RITMs. However, for a few RITMs, even though the state successfully changes to Fulfilled, the custom Date/Time field remains empty.

 

I added gs.info(); statements within the Business Rule for debugging. However, no log entries are being generated for the affected RITMs, even though the state change to Fulfilled is completed successfully.

 

Has anyone experienced similar behavior with RITM fulfillment? Could this be related to fulfillment workflows/flows, execution order, or multiple updates during state transition?

Any suggestions or best practices to ensure the field is populated would be greatly appreciated.

 

Thank you in advance for your help.

8 REPLIES 8

Ankur Bawiskar
Tera Patron

@MHimabindu 

you didn't share the BR config screenshots etc

Regards,
Ankur
Certified Technical Architect  ||  10x ServiceNow MVP  ||  ServiceNow Community Leader

MHimabindu
Tera Contributor

Hello All,

 

Thanks for responses,

 

Here is the configuration set up - 

When to Run - Before Update

Condition - State Changes to Fufilled

Script - current.field = gs.nowDateTime();

 

Changing Order wasn't helpful either, Fulfillment is through workflow/flow, yet data and time are set using BR. 

 

Using an After Business Rule on the Fulfilled state would cause the logic to execute on every subsequent update after the item is already fulfilled, which is not desirable for this use case.
 
Regards,
HimaBindu

@MHimabindu 

better to use GlideDateTime instead of gs.nowDateTime

current.setValue('field', new GlideDateTime());

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

Regards,
Ankur
Certified Technical Architect  ||  10x ServiceNow MVP  ||  ServiceNow Community Leader

PradeepReddyA
Tera Expert

Hi @MHimabindu 

 

If you are using the nowDateTime() in the scoped applications it may not work as expected try to use 

GlideDateTime() instead.
 
Hope that Helps!