What I Learned During Pair Programming This Week
For #ServiceNow fans — I learned the real benefit of using an ASYNC business rule.
Here was my problem: I had an after business rule that relied on values set by a UI Action to implement some business logic on a record in another table. When the after business rule ran, it was returning null values even though the UI Action was setting values before doing a current.update().
This was causing problems in the after business rule’s logic that relied on certain values in those fields being set by the UI Action. Thanks to @John Bowker and @Joseph Mertens for helping me better understand how the ASYNC business rule works. By changing that business rule from an after business rule to an ASYNC business rule, the field values became available; therefore, allowing the proper business logic to be implemented.
Here’s the ServiceNow documentation on ASYNC business rules. “When the scheduler runs the scheduled job created from the business rule. The system creates a scheduled job from the business rule after the user submits the form and after any action is taken on the record in the database.” [emphasis added]
So in my situation, the after business rule was, for some reason, apparently not running at the right time to be able to see the UI Action’s field updates. By changing to an ASYNC business rule, the scheduled job that the async business rule created actually waited until after the database record was updated to run, thus giving my business rule a chance to see those UI Action-updated values. It would seem like the after business rule should only run AFTER the record was updated by the UI Action's current.update(), but that after business rule apparently ran before the record was updated.
So I learned that it's better to involve all members of a SCRUM team and that getting them involved early reaps tremendous benefits. Pair programming is awesome sauce - give it a try!
--
Great job guys!!
President & CEO of Chainbridge Solutions Inc.
4 年Proud of you Rick Forristall John Bowker Joseph Mertens!!! Practicing collaboration, self organizing, and team work!!! Keep it up!
PHP/MySQL/Drupal web developer ready for a management role
4 年I love pair programming!