- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-13-2025 01:34 AM
We are using service bridge RTD (Remote Task Definition) and have configured a state mapping transform. However, we have a state on our provider instance which when selected we do not want that state to send any state change to the consumer. Any idea how we would do that?
As a direct example, when our state changes to 'Customer Updated' (state value of 19 below) we do not want the state to be sent to the consumer. I've tried using '' or 'null' but this then results in sending a blank state which then causes issues on both instances. How can I add an 'abort' message into the transform?
if (direction == "outbound") {
if (check == 1) {
output.value = '1';
output.label = 'Open';
} else if (check == 2) {
output.value = '2';
output.label = 'Work in Progress';
} else if (check == 3) {
output.value = '-5';
output.label = 'Pending';
} else if (check == 7) {
output.value = '3';
output.label = 'Closed Complete';
} else if (check == 8) {
output.value = '4';
output.label = 'Closed Incomplete';
} else if (check == 19) {
output.value = 'null';
output.label = 'null';
} else {
output.value = '2';
output.label = 'Work in Progress';
}
}
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
9 hours ago - last edited 9 hours ago
Hi @Lakshmi Prabha1 ,
Yes, I managed to find a workaround. In short, I had to put a transform on both consumer and provider for the state field mapping to manage the inbound and outbound fields on both instances. So on the provider:
output.value = input.value;
output.label = input.label;
var check = parseInt(input.value);
var onhold_reason = object_data.parent.u_on_hold_reason;
var reason = parseInt(onhold_reason);
var state = object_data.parent.state;
if (direction == "inbound") {
//gs.info('BMS direction inbound state:'+check);
if (check == '1') {
if (state == '2') {
output.value = '2';
output.label = 'In Progress';
} else {
output.value = '1';
output.label = 'New';
}
} else if (check == '2') {
if (state == '11') {
output.value = '11';
output.label = 'Monitoring Updated';
} else {
output.value = '2';
output.label = 'In Progress';
}
} else if (check == '4' || check == '7') {
output.value = '8';
output.label = 'Canceled';
} else if (check == '3') {
output.value = '7';
output.label = 'Closed';
} else if (check == '-5') {
if (state == '19') {
output.value = '19';
output.label = 'Customer Updated';
} else if (state == '6') {
output.value = '6';
output.label = 'Resolved';
} else {
output.value = '3';
output.label = 'On Hold';
}
} else {
output.value = '19';
output.label = 'Customer Updated';
}
}
if (direction == "outbound") {
//gs.info('BMS direction outbound state:'+check);
if (check == '1') {
output.value = '1';
output.label = 'Open';
} else if (check == '2' || check == '11') {
output.value = '2';
output.label = 'Work in Progress';
} else if (check == '6') {
output.value = '-5';
output.label = 'Pending';
} else if (check == '3') {
output.value = '-5';
output.label = 'Pending';
} else if (check == '8') {
output.value = '7';
output.label = 'Closed Skipped';
} else if (check == '7') {
output.value = '3';
output.label = 'Closed Complete';
} else if (check == '19') {
output.value = '19';
} else {
output.value = '2';
output.label = 'Work in Progress';
}
}
And then on the consumer to manage the inbound this was added.... it's been a few months and I don't have access to the consumer anymore so the outbound section is missing (I had to refer to my OneNote for what I'd noted down previously) but it should give you a template to work from. The above transform should be replicated for outbound according to what state you want:
if (direction == "inbound") {
//gs.info('XXXXXXX direction inbound state:'+check);
if (check == 1) {
output.value = '1';
output.label = 'Open';
} else if (check == 2) {
output.value = '2';
output.label = 'Work in Progress';
} else if (check == 3 || check == 6) {
output.value = '-5';
output.label = 'Pending';
} else if (check == 7) {
output.value = '3';
output.label = 'Closed Complete';
} else if (check == 4) {
output.value = '4';
output.label = 'Closed Incomplete';
} else if (check == 19) {
if (state == '1') {
output.value = '1';
output.label = 'Open';
} else if (state == '2') {
output.value = '2';
output.label = 'Work in Progress';
} else if (state == '-5') {
output.value = '-5';
output.label = 'Pending';
}
}
}
You'll notice that on the consumer transform for the '19' value there's a series of if/else if statements which checks the current value of the state on the parent record, so that means that if the consumer parent task is in a value of '1' and Service Bridge sends over a value of '19' then it transforms the '19' into a '1' which effectively means the state remains as it was before the value was sent over.
Please note that the provider is on the incident table and the consumer is on the incident task table, hence why you might see the state values seem out of sync. However, by putting transforms on each instance with if/else if statements there to manage the behaviour this should enable you to overcome the issue. In effect, rather than preventing the sending of the value it's managing/manipulating the values to be what you want it to be on the receiving side.
Hope that helps!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yesterday
Are you able to resolve this issue? I am facing the same issue.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
9 hours ago - last edited 9 hours ago
Hi @Lakshmi Prabha1 ,
Yes, I managed to find a workaround. In short, I had to put a transform on both consumer and provider for the state field mapping to manage the inbound and outbound fields on both instances. So on the provider:
output.value = input.value;
output.label = input.label;
var check = parseInt(input.value);
var onhold_reason = object_data.parent.u_on_hold_reason;
var reason = parseInt(onhold_reason);
var state = object_data.parent.state;
if (direction == "inbound") {
//gs.info('BMS direction inbound state:'+check);
if (check == '1') {
if (state == '2') {
output.value = '2';
output.label = 'In Progress';
} else {
output.value = '1';
output.label = 'New';
}
} else if (check == '2') {
if (state == '11') {
output.value = '11';
output.label = 'Monitoring Updated';
} else {
output.value = '2';
output.label = 'In Progress';
}
} else if (check == '4' || check == '7') {
output.value = '8';
output.label = 'Canceled';
} else if (check == '3') {
output.value = '7';
output.label = 'Closed';
} else if (check == '-5') {
if (state == '19') {
output.value = '19';
output.label = 'Customer Updated';
} else if (state == '6') {
output.value = '6';
output.label = 'Resolved';
} else {
output.value = '3';
output.label = 'On Hold';
}
} else {
output.value = '19';
output.label = 'Customer Updated';
}
}
if (direction == "outbound") {
//gs.info('BMS direction outbound state:'+check);
if (check == '1') {
output.value = '1';
output.label = 'Open';
} else if (check == '2' || check == '11') {
output.value = '2';
output.label = 'Work in Progress';
} else if (check == '6') {
output.value = '-5';
output.label = 'Pending';
} else if (check == '3') {
output.value = '-5';
output.label = 'Pending';
} else if (check == '8') {
output.value = '7';
output.label = 'Closed Skipped';
} else if (check == '7') {
output.value = '3';
output.label = 'Closed Complete';
} else if (check == '19') {
output.value = '19';
} else {
output.value = '2';
output.label = 'Work in Progress';
}
}
And then on the consumer to manage the inbound this was added.... it's been a few months and I don't have access to the consumer anymore so the outbound section is missing (I had to refer to my OneNote for what I'd noted down previously) but it should give you a template to work from. The above transform should be replicated for outbound according to what state you want:
if (direction == "inbound") {
//gs.info('XXXXXXX direction inbound state:'+check);
if (check == 1) {
output.value = '1';
output.label = 'Open';
} else if (check == 2) {
output.value = '2';
output.label = 'Work in Progress';
} else if (check == 3 || check == 6) {
output.value = '-5';
output.label = 'Pending';
} else if (check == 7) {
output.value = '3';
output.label = 'Closed Complete';
} else if (check == 4) {
output.value = '4';
output.label = 'Closed Incomplete';
} else if (check == 19) {
if (state == '1') {
output.value = '1';
output.label = 'Open';
} else if (state == '2') {
output.value = '2';
output.label = 'Work in Progress';
} else if (state == '-5') {
output.value = '-5';
output.label = 'Pending';
}
}
}
You'll notice that on the consumer transform for the '19' value there's a series of if/else if statements which checks the current value of the state on the parent record, so that means that if the consumer parent task is in a value of '1' and Service Bridge sends over a value of '19' then it transforms the '19' into a '1' which effectively means the state remains as it was before the value was sent over.
Please note that the provider is on the incident table and the consumer is on the incident task table, hence why you might see the state values seem out of sync. However, by putting transforms on each instance with if/else if statements there to manage the behaviour this should enable you to overcome the issue. In effect, rather than preventing the sending of the value it's managing/manipulating the values to be what you want it to be on the receiving side.
Hope that helps!