Phillip Godwin
ServiceNow Employee
ServiceNow Employee

  The Service Bridge Remote Task Definition allows an admin to specify what fields are to be passed back and forth between a connected Provider and Consumer using a Remote Task.  Transforms can be specified that will alter a field value and/or label as it is passed from (outbound transform) and/or to (inbound transform) the Provider or Consumer instances.  An Advanced Transform allows the admin to include a script that will transform the data between the instances as required.

 

Service Bridge provides an object_data.remote_task_vars object that enables the reference and use in a transform script of any of the fields that have been included in the Remote Task Definition.  The purpose of this article is to describe how to reference Remote Task variables from a transform script.

 

I will use a simple example to demonstrate how this can be done.  My Remote Task Definition will trigger a Remote Task on the Consumer instance when an incident is assigned to the “Network Support” group, and the task will flow to the Provider instance and create a corresponding case.  In the Remote Task Definition, I have specified that the inbound Description field will synchronize between the incident and the case on Insert, and I have included the consumer incident Number as an inbound field but have specified that it will Never synch (i.e. it will not be written to a corresponding provider case field).

 

PhillipGodwin_0-1712177339802.png

 

I will use an Advanced Transform to add the customer’s incident number to the provider’s case description so the provider will have an easily visible reference to use in related discussions with the customer.

 

As mentioned above, the specified Remote Task variables can be referenced using the object_data.remote_task_vars object, but I need to know what the related field name for the incident number is so I can use it in my script.  To find a Remote Task variable field name, open the related Remote Task Definition and select the Remote tasks variables related list. 

 

PhillipGodwin_1-1712177339813.png

 

I can see that the field name for the inbound incident number is: number50270d9ec31c8210075c35aa05013126.

 

Now I can create an Advanced Transform with a script that uses the number field to transform the provider case description.

 

PhillipGodwin_2-1712177339819.png

 

See that the script adds the customer’s incident number to the case description by referring to the number field in the remote task variables object:

 

PhillipGodwin_3-1712177339822.png

 

And see the result…

 

PhillipGodwin_4-1712177339827.png

 

 

I hope this article helps you better understand how you can pass fields using Service Bridge Remote Tasks and then use them in your Transform scripts!

7 Comments
Community Alums
Not applicable

Really useful tip, thanks Phillip

fenilpatel
Tera Contributor

 

Removed Question. Thanks for the KB!

Phillip Godwin
ServiceNow Employee
ServiceNow Employee

Hi - My guess is that you've activated a new revision of the remote task since the transform was created and the service_offering variable name changed.  After the Xanadu store release, when you create a new revision of a remote task definition it creates an entirely new version and the variable names in object_data.remote_task_var will change. 

 

...phil

MattSN
Mega Sage
Mega Sage

@Phillip Godwin Thank you for the clarity on the object_data.remote_task_var change between versions. If I understand correctly, this means that any time you update your task definition, (for example to add a new field), you have update all transforms associated to the definition, on any field that uses the object_data.remote_task_var.

 

This seems like a regression. Is this accurate? Is there a better option?

Phillip Godwin
ServiceNow Employee
ServiceNow Employee

Hi @MattSN - this is being fixed in the August store release (taking the sys_id out of the variable name).

 

...phil

MattCD
Tera Contributor

Excellent news! Thanks @Phillip Godwin we appreciate the communication from your product team in these channels.

Michael Ramos
Tera Contributor

@Phillip Godwin This seems really useful, but one thing I feel like I am seeing is that the values of the variables in object_data.remote_task_vars are the values on the remote task before the transforms are run.

So equivalent to previous. We have a use case a partner wants where when we Resolved our Case it updates their incident's Resolution code to a specific value on their side. But only when our Case changes to the Resolved state.

 

On inbound  transforms we aren't able to figure out how to access the state variable's inbound value within the resolution code transform to build that logic. The object_data.remote_task_vars.state value would show the old value and not the new intended value sent to the consumer side at the time of transform.

 

Is this even possible with the current transform capabilities or would you have to handle in some other way as a secondary update to the parent task (incident in this case) with a flow or after BR on the remote task table?