0

Passing properties from a flow designer step to a form

We have a flow that finds all open events sharing a common "group" property, and then terminates them all. For each event terminated, we need to send an SMS message containing certain properties to a machine outside of xMatters. 

Right now, the messages are being sent, but we are having trouble passing the necessary properties along so that they appear on the form.

For this purpose we are using a shared library containing the code below. When the form is triggered, the resulting event doesn't contain any properties besides recipient and initiator. 

exports.ackSSGNagios = function( propertiesString ) {
var request = null;
var request_4SSG_Nagios = http.request({
'endpoint': 'xMatters',
'method': 'POST',
'path': '/reapi/2015-04-01/forms/5f992a7a-7fe6-45b4-b05b-cf2ac137ed2f/triggers',
'headers': {
'Content-Type': 'application/json'
}
});

var properties = JSON.parse(propertiesString);

console.log("IN ackSSGNagios METHOD!");
console.log("RECEIVED_PROPS == " + propertiesString);

// Check for proper GROUP and SEVERITY:
if (properties['group#en'] == "ssg-hosting" || properties['group#en'] == "ssg-network" || properties['group#en'] == "ssg-os-linux" || properties['group#en'] == "ssg-os-windows" ||
properties['group#en'] == "database" || properties['group#en'] == "mysql-database" || properties['group#en'] == "sqlserver-database" || properties['group#en'] == "webinfra-pager") {
request = request_4SSG_Nagios;

console.log("AFTER GROUP FILTER!");
if (properties['severity#en'].toUpperCase() != "NORMAL") {
//var json = {};
//json.ticket = {};
var data = {};
data.properties = {};

console.log("EVENT_PROPERTIES == " + JSON.stringify(properties));
//json.ticket.properties = properties;
data.properties = properties;

var response = null;

console.log("READY TO PAGE!");
//response = request.write(json.ticket);
response = request.write(data);
// Write the response to the activity stream
if (response !== null) {
console.log("RESPONSE_DATA: " + JSON.stringify(response));
}
}
}
};

1 comment

Please sign in to leave a comment.