//===== [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=06fe6b771b193c1090dfdb9ebd4bcbe0]", 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;
$stage.short_description = '' + (source.short_description || default_value);
} else if (source.short_description != '') {
$stage.short_description = '' + source.short_description;
x_snd_eb.ws_console.execute("Mapping incident.state [x_snd_eb_field.do?sys_id=f2db33f71b193c1090dfdb9ebd4bcbc5]", 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 (!source.state.nil()) {
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', '=', 'Outbound');
field_choice.addQuery('value', '=', source.state);
field_choice.addQuery('active', '=', 'true');
if (field_choice.next()) {
$stage.state = '' + field_choice.external_value;
$stage.state = '' + (source.state || '');
$stage.state = '' + (source.state || '');
x_snd_eb.ws_console.execute("Mapping incident.comments [x_snd_eb_field.do?sys_id=79fe6b771b193c1090dfdb9ebd4bcbcd]", 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;
$stage.comments = '' + (source.comments || default_value);
} else if (source.comments != '') {
$stage.comments = '' + source.comments;
x_snd_eb.ws_console.execute("Mapping incident.work_notes [x_snd_eb_field.do?sys_id=4efe6b771b193c1090dfdb9ebd4bcbd1]", 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;
$stage.work_notes = '' + (source.work_notes || default_value);
} else if (source.work_notes != '') {
$stage.work_notes = '' + source.work_notes;
x_snd_eb.ws_console.execute("Mapping incident.close_code [x_snd_eb_field.do?sys_id=eaaff7bb1b193c1090dfdb9ebd4bcb6f]", function () {
log.debug("Field map: PI - Choice [x_snd_eb_field_map.do?sys_id=c7b97f7a1b51b81090dfdb9ebd4bcb62]");
var default_value = (function () {
if (!source.close_code.nil()) {
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', '=', 'Outbound');
field_choice.addQuery('value', '=', source.close_code);
field_choice.addQuery('active', '=', 'true');
if (field_choice.next()) {
$stage.close_code = '' + field_choice.external_value;
if (!$stage.close_code) {
$stage.close_code = '' + (source.close_code || '');
$stage.close_code = '' + (source.close_code || '');
x_snd_eb.ws_console.execute("Mapping incident.close_notes [x_snd_eb_field.do?sys_id=0bd508401b693c1090dfdb9ebd4bcb5a]", 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
$stage.close_notes = '' + (source.close_notes || default_value);
} else if (source.close_notes != '') {
$stage.close_notes = '' + source.close_notes;
var error = x_snd_eb.ws_console.findCheckpointError("MessageScript");
if (error) throw error.message;
//===== [ws] End Unifi Auto Generated Code =====//