- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-16-2025 12:24 PM
Hi Service Bridgers
Anyone using the Transforms for Service Bridge know of a way to get the current object or the related task object in a transform?
Feature Reference:
https://www.servicenow.com/docs/csh?topicname=service-bridge-v2-create-transform.html&version=latest
I was able to get current.parent.sys_id in a Service Bridge transform but found that it only worked when the record was intitially synced. Aftwards the "current" object was not available in the transform script. Is this expected or documented? Is there a better way?
@Mike Edmonds of the TMT team?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-20-2025 01:39 PM
If you run JSON.stringify(current) against any table you will get the same result. Here is a snippet from running in a business rule on the incident table.
Here are some examples to try running in the Transform.
Note: Parent does not fully exist until after the remote task has been created. Dot-walking to a parent field will not work when a remote task is first synced and could result in an error. Parent will be the sys_id of the sys_id of the parent. You should perform a check such as object_data.parent.number != "" before trying to access dot-walked fields.
gs.info('Object Data - Inbound Vars JSON: ' + object_data.inbound_vars_json);
gs.info('Object Data - object_data.parent.number: ' + object_data.parent.number);
gs.info('Object Data - object_data.parent.assignment_group.description: ' + object_data.parent.assignment_group.description);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-16-2025 01:34 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-20-2025 06:29 AM
Thanks @Kenny Caldwell I have added to the transform a dump of of the object_data object and logged it using JSON.stringify(); It contains the fields but every object is empty. Snippt below:
object_dump {
"sys_meta": null,
"parent": {},
"made_sla": {},
"watch_list": {},
"consumer_connection": {},
"inbound_vars_json": {},
"upon_reject": {},
......
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-20-2025 01:39 PM
If you run JSON.stringify(current) against any table you will get the same result. Here is a snippet from running in a business rule on the incident table.
Here are some examples to try running in the Transform.
Note: Parent does not fully exist until after the remote task has been created. Dot-walking to a parent field will not work when a remote task is first synced and could result in an error. Parent will be the sys_id of the sys_id of the parent. You should perform a check such as object_data.parent.number != "" before trying to access dot-walked fields.
gs.info('Object Data - Inbound Vars JSON: ' + object_data.inbound_vars_json);
gs.info('Object Data - object_data.parent.number: ' + object_data.parent.number);
gs.info('Object Data - object_data.parent.assignment_group.description: ' + object_data.parent.assignment_group.description);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-21-2025 07:50 AM
Thanks @Kenny Caldwell for the reminder on the missing data on the JSON blob of the current object and thanks for sharing your examples. This should be a helpful future reference.