Check other field values in advanced transform script in service bridge

Vinay49
Tera Expert
When case is resolved in provider instance. The incident also should be resolved in consumer side. We had state & resolution notes field mapping for this.
At one situation, where case might be resolved without resolution notes from backend, at that time Incident is not resolved as resolution notes is mandatory to resolve  the incident in consumer instance.

Our requirement here is, Can we pass default resolution notes to remote task where case is resolved & resolution notes is empty.


Ans: One solution for this is to have an advanced outbound transform for resolution notes on the provider.  The transform script would check for when state is resolved and then if resolution notes is empty then set it to your default resolution note. 


How can we  check the state value in transform script.
I have written advanced outbound transform for resolution notes on the provider with below code. How can we add the state value here?

if
 (!input.value) {
    output.value = 'Resolved by Provider';
    output.label = 'Resolved by Provider';

 

else {
    output.value = input.value;
    output.label = input.label;
}
1 ACCEPTED SOLUTION

Kenny Caldwell
ServiceNow Employee
ServiceNow Employee

Here is a simple example.

var state = object_data.parent.state + '';

if (state == '2') {
	gs.info('State is 2');
}

if (state == '1') {
	gs.info('State is 1');
}

View solution in original post

2 REPLIES 2

Kenny Caldwell
ServiceNow Employee
ServiceNow Employee

Here is a simple example.

var state = object_data.parent.state + '';

if (state == '2') {
	gs.info('State is 2');
}

if (state == '1') {
	gs.info('State is 1');
}

Thanks Kenny. It works