//===== [ws] Begin Unifi Auto Generated Code =====//
* This code (between the Begin and End comments) is generated from the
* Field and Field mapping records which are configured as part of the integration.
* All code either above or below the comments will be automatically maintained
* through the build cycle.
* WARNING: Do not edit the Begin or End comments.
x_snd_eb.ws_console.checkpoint("MessageScript")
x_snd_eb.ws_console.execute("Mapping incident.short_description [x_snd_eb_field.do?sys_id=077216b21be9f05090dfdb9ebd4bcb1c]", function () {
log.debug("Field map: PI - String [x_snd_eb_field_map.do?sys_id=da997f7a1b51b81090dfdb9ebd4bcb5e]");
var default_value = (function () {
// Determines whether this instance of the field map is for a mandatory field
var is_mandatory = false;
if (is_mandatory && $stage.short_description == '') {
throw 'Mandatory field short_description was not provided';
target.short_description = '' + ($stage.short_description || default_value);
x_snd_eb.ws_console.execute("Mapping incident.description [x_snd_eb_field.do?sys_id=0f7216b21be9f05090dfdb9ebd4bcb20]", function () {
log.debug("Field map: PI - String [x_snd_eb_field_map.do?sys_id=da997f7a1b51b81090dfdb9ebd4bcb5e]");
var default_value = (function () {
// Determines whether this instance of the field map is for a mandatory field
var is_mandatory = false;
if (is_mandatory && $stage.description == '') {
throw 'Mandatory field description was not provided';
target.description = '' + ($stage.description || default_value);
x_snd_eb.ws_console.execute("Mapping incident.state [x_snd_eb_field.do?sys_id=daba16b21be9f05090dfdb9ebd4bcb4e]", function () {
log.debug("Field map: PI - Choice [x_snd_eb_field_map.do?sys_id=c7b97f7a1b51b81090dfdb9ebd4bcb62]");
var default_value = (function () {
var is_mandatory = false;
if (is_mandatory && $stage.state == undefined) {
throw 'Mandatory field state was not provided';
field_choice = new GlideRecord('x_snd_eb_field_choice');
field_choice.addQuery('table', '=', 'incident');
field_choice.addQuery('element', '=', 'state');
field_choice.addQuery('integration', '=', '27be43a91b9db41090dfdb9ebd4bcb2e');
field_choice.addQuery('field.message', '=', '');
field_choice.addQuery('direction', '=', 'Inbound');
field_choice.addQuery('external_value', '=', $stage.state);
field_choice.addQuery('active', '=', 'true');
if (field_choice.next()) {
target.state = field_choice.value;
target.state = $stage.state;
x_snd_eb.ws_console.execute("Mapping incident.close_code [x_snd_eb_field.do?sys_id=bdfa22be1be9f05090dfdb9ebd4bcb9b]", function () {
log.debug("Field map: PI - Choice [x_snd_eb_field_map.do?sys_id=c7b97f7a1b51b81090dfdb9ebd4bcb62]");
var default_value = (function () {
if (is_mandatory && $stage.close_code == undefined) {
throw 'Mandatory field close_code was not provided';
field_choice = new GlideRecord('x_snd_eb_field_choice');
field_choice.addQuery('table', '=', 'incident');
field_choice.addQuery('element', '=', 'close_code');
field_choice.addQuery('integration', '=', '27be43a91b9db41090dfdb9ebd4bcb2e');
field_choice.addQuery('field.message', '=', '');
field_choice.addQuery('direction', '=', 'Inbound');
field_choice.addQuery('external_value', '=', $stage.close_code);
field_choice.addQuery('active', '=', 'true');
if (field_choice.next()) {
target.close_code = field_choice.value;
target.close_code = $stage.close_code;
x_snd_eb.ws_console.execute("Mapping incident.close_notes [x_snd_eb_field.do?sys_id=c9532af61be9f05090dfdb9ebd4bcbb4]", function () {
log.debug("Field map: PI - String [x_snd_eb_field_map.do?sys_id=da997f7a1b51b81090dfdb9ebd4bcb5e]");
var default_value = (function () {
// Determines whether this instance of the field map is for a mandatory field
if (is_mandatory && $stage.close_notes == '') {
throw 'Mandatory field close_notes was not provided';
target.close_notes = '' + ($stage.close_notes || default_value);
var error = x_snd_eb.ws_console.findCheckpointError("MessageScript");
if (error) throw error.message;
//===== [ws] End Unifi Auto Generated Code =====//