- Post History
- Subscribe to RSS Feed
- Mark as New
- Mark as Read
- Bookmark
- Subscribe
- Printer Friendly Page
- Report Inappropriate Content
Wednesday - edited Wednesday
This post is part of a two-part post. The other post can be found here Service Bridge: Preventing False Positives in Service Bridge Transform Conditions . It covers how to prevent false positives because a transform runs two times on updates. These two posts are used together to create a complete solution. See notes at bottom of this article.
Introduction
When remote task updates are synced with Service Bridge from one instance to another instance, we can think of it as sending data from a source instance and a target instance. On the source instance a record is updated which is synced to the target instance and triggers an update on the target instance. Service Bridge suppresses syncing these updates back to source instance to prevent looping. There are reasons the target instance would want to sync data/communicate back to the source instance during processing of an update from the source instance.
Why would the target instance send an update to the source instance during processing of an update from the source instance?
One reason may be if a condition in a transform blocks an update to the target instance remote task and parent, the source instance may want to be notified that the change was not permitted.
How can we handle sending updates back to the consumer during processing?
By asynchronously updating the target instance parent record with a user other than the Service Bridge integration user. This can be accomplished by creating a scheduled script which sets the “Run as” field to a user other than the integration user. The default value for the “Run as” field is the logged in user. If “Run as” is left blank, the Service Bridge Integration User will be used, and the update will not sync to the source instance.
Solution
Create a script that generates a Scheduled Script Execution [sysauto_script] to update the parent record. Scripts added directly in the transform run within the Service Bridge application scope because they are read into and evaluated within the Service Bridge application scope, causing cross-scope access issues. Instead, create a global Script Include and invoke it from the transform map for best results.
In this example, a scheduled script execution is used to update the incident on the target instance with a comment, which then communicates the comment back to the source instance through Service Bridge.
Call the global script include ServiceBridgeTransformMethods from the transform
addConsumerComment method generates a Scheduled Script Execution that adds a comment to the parent which gets synced to the source instance.
Notes
- Sample scripts for demonstration purposes. Please test thoroughly in your sub-production environment and modify as needed for your specific use case. Use at your own discretion.
- Attached is an example Service Bridge Provider transform, which contains a call to the method addConsumerComment.
- Attached is an example Global Script Include, ServiceBridgeTransformMethods, which features the addConsumerComment method.
- The attachments are components of the complete solution discussed in this two-part post, and each post includes these attachments.
- 74 Views
