With Replicator, you can specify when business rules should run for dynamic shares. Dynamic shares can replicate data before an action is taken on the record or after an action is taken. These before and after values can be specified in the Business Rule When dropdown of a dynamic share (under the Trigger Conditions tab).
Business Rule Before
Dynamic sharing a record using the before option will allow you to share the record with journal fields as part of the record's XML. For example, if you share an incident record and specify “before”, the record will come with both the comments and work notes in the incident record's XML. Additionally, using the before option will cause the record to be shared before any after business rules are run. For example, if you have an after business rule that runs to update the record's state based on a specific condition, the after option will share the record out with the updated state, whereas the before option will share it with the previous state.
Business Rule After
If you dynamic share a record using the after option, the comments and work notes will not be part of the record's XML but instead will be records in the sys_journal_field table (ServiceNow upon saving a record into the database will separate journal fields from the record and save them into the sys_journal_field and sys_audit tables which is why you want to subscribe to the sys_journal_field and sys_audit tables when subscribing on a ServiceNow instance).
Business Rule Async
Note that when running as async, records will be sent out as .bulk, since the records are shared in the background and we will not be able to determine if the record was an insert or update at that point. Also, there is no dependency on “current” or “previous” in the Before Share script (such as checking for a condition where a field “changes”) and the “sequence” of other records being replicated cannot be guaranteed. So a change created when an incident is created where both have dynamic shares may result in the change being shared out before the incident is).
NOTE: Selecting the async option will cause the trigger condition Update or Insert to be activated and the Delete trigger condition to be deactivated.
To configure business rule timing for a dynamic share, follow these steps:
Log into your sharing ServiceNow instance and navigate to Perspectium > Replicator > Dynamic Share or simply type and then click Dynamic Share in the Filter Navigator on the upper left-hand side of the screen.
Click the name of the dynamic share you want to configure the business rule timing for.
Under the Trigger Conditions tab, choose the business rule timing you want to configure from the Business Rule When dropdown.
In the upper right-hand corner of the form, click Update to save your changes.